My SQL query counts the number of rows that meet a criteria. Sometimes this value is 0 or 1. This will create an error about returning a boolean.
How can this be avoided? Should I not use mysql_fetch_array?
// Query the db to count the # of comments.
$price_change_dbo =
mysql_query("
SELECT COUNT(1) AS comment_count
FROM comments
WHERE user_id = '{$user_id}';"
);
// Use the result.
$price_change_row = mysql_fetch_array($price_change_dbo);
Here is the warning:
Warning: mysql_fetch_array() expects parameter 1 to be resource,
boolean given in /Applications/MAMP/... on line 1.