I am trying to do the following.
SELECT from database and echo, If there are less than 3 results, I want to subtract the amount of results from 3 and use an alternative SELECT string, The code works and does what I expect of it except for the error in the logs.
PHP Warning: mysql_num_rows() expects parameter 1 to be resource, null given in
This error seems to be because the result is empty, How can I check how many rows in a result without getting an error when the table has no results.
$sqls="SELECT * FROM xxx ORDER by xxx_id ASC LIMIT 0,3";
$objRs = mysql_query($sqls);
The database works, the SQL query works, the row below this is the one giving me the error when I have a NULL result. Is there another way to check the number of rows without getting the server pissed at me
$count = mysql_num_rows($objRS);
If (!empty($count)) {
$pnb = 3;
} else {
while($rows = mysql_fetch_array($objRs, MYSQL_ASSOC)) {