Okay, so I am having a problem. I seem to be unable to successfully echo an SQL Count in PHP.
SQL:
SELECT TableA.C, COUNT(*) FROM TableA JOIN TableB ON (TableA.C = TableB.D)
WHERE TableB.E = 1 GROUP BY TableA.C ORDER BY COUNT(*) DESC
PHP:
$result= mysql_query("SELECT TableA.C, COUNT(*) FROM TableA JOIN TableB ON (TableA.C = TableB.D)
WHERE TableB.E = 1 GROUP BY TableA.C ORDER BY COUNT(*) DESC");
while($rows = mysql_fetch_array($result))
{
echo $rows['Count']."</br>";
}
$rows = mysql_fetch_array($result);
{
echo $rows['Count'];
}
I've tried two different things I've found online (the above). I even tried one with "mysql_fetch_array($result, MYSQL_ASSOC)" instead of just mysql_fetch_array($result).
Each time, I get the same error messages:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
/home/semsemx1/public_html/x/xx.php
Additionally, I've tried capitalizing as "$rows['COUNT']
", but that doesn't work.
Any help would be appreciated.