Hello. I'm so pleased to find this wonderful, active forum! I'm very new to php and I'm trying to learn it, but I really need a bit of help. You see, I'm trying to generate a simple "stats" page from a table in my MySQL database. I want a series of single number results, e.g., total number of records in the table, number of 2's in field such and such, number of 3's in the field..., etc. - Just statistics
I connect to my database, then declare each variable with a SQL query for them. Then create my table and echo the resulting variable into each cell - right?
Well, I get is a single number in each cell, but they are wrong numbers and oddly they are sequential (the first number is 8, then 9, then 10, then 11 and so on.
This is the PHP I'm using:
<?php
$total = mysql_query("SELECT COUNT(appID) FROM awards GROUP BY appID;",$db);
$brown = mysql_query("SELECT COUNT(appID) FROM awards WHERE awards.awardID=1",$db);
$emerald = mysql_query("SELECT COUNT(appID) FROM awards WHERE awards.awardID=2 GROUP BY awards.appID",$db);
$inprogress = mysql_query("SELECT COUNT(appID) FROM awards WHERE statusID<5 GROUP BY appID",$db);
?>
<table>
<tr align="center">
<td align="right">July 2001</td>
<td align="center"><?php echo $total ?></td>
<td align="center"><?php echo $inprogress ?></td>
<td align="center"><?php echo $brown ?></td>
<td align="center"><?php echo $emerald ?></td>
</tr></table>
Any ideas?




Bookmarks