I should have these set up correctly, but I'm beginning to doubt the problem is in my code, so it's possible I may have missed something. A brief overview of the code I'm trying to run,
<?php
$link = mysql_connect('localhost', 'root');
ERROR CHECKING
$db = mysql_select_db('dbname');
ERROR CHECKING
$ds_u = mysql_query("SELECT count(*) FROM ds WHERE status = 'u' OR status = 'b'");
$ds_c = mysql_query("SELECT count(*) FROM ds WHERE status = 'c'");
$ds_tot = mysql_query("SELECT count(*) FROM ds WHERE status != 'w'");
?>
. . .
<table class="percent">
<tr>
<td width="<?=$ds_u?>/<?=$ds_tot?> %"> </td>
<td width="<?=$ds_c?>/<?=$ds_tot?> %"> </td>
</tr>
</table>
This should emulate the static version,
<table class="percent">
<tr>
<td width="5/7 %"> </td>
<td width="2/7 %"> </td>
</tr>
</table>
but it doesn't. My ERROR CHECKING doesn't return anything, so I'm assuming either 1) my code is incorrect -or- 2) none of the PHP code is being recognized. PHP is installed locally, I can check the version number and everything, but maybe I missed something when I set up Apache. I can provide more code if necessary, but those 2 snippets are the only bits I've changed from my old (working) version thus far. Is there a test file I can run with Apache to make sure it's running correctly?
Posts
That function runs the query, but it returns a handle, not the number you're wanting.
you'll need to call mysql_fetch_array($ds_u) to get the actual value.