Below is how I generate a count query of records in my customers table:
<? $count = mysql_query("SELECT COUNT(*) FROM customers WHERE status = '1'");
while ($row = mysql_fetch_array($count)) {
$count = $row['COUNT(*)'];
}
?>
<? echo $count; ?> Active Customers
The count does return the proper number of records, but I get this error in the logs:
PHP Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /customers.php on line 39
If it works, why do I see an error in the error_log. Is there a better way?