martynball
04-03-2010, 07:27 PM
//Count number of unaccepted reviews
$result=mysql_query("SELECT * FROM comments");
//Counter
$i=0;
while ($row = mysql_fetch_array($result)) {
$accept=$row['accepted'];
if ($accepted == 0) {
$i++;
}
}
I just tested the query by adding:
if (!$result) { echo "Error"; }
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/folder/public_html/admin/manage_reviews.php on line 12
I want it to count the number of rows which have the value of 0 in the accepted column.
$result=mysql_query("SELECT * FROM comments");
//Counter
$i=0;
while ($row = mysql_fetch_array($result)) {
$accept=$row['accepted'];
if ($accepted == 0) {
$i++;
}
}
I just tested the query by adding:
if (!$result) { echo "Error"; }
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/folder/public_html/admin/manage_reviews.php on line 12
I want it to count the number of rows which have the value of 0 in the accepted column.