I need to know the number of records ($ct) in a results set.
$q = 'select * from table where id = 113';
$results = mysql_query($q);
$ct = mysql_num_rows($results);
In the database in the scenario above, record with id 113 does not exist, therefore the resultset is empty. When trying to check the number of records, it returns this error:
supplied argument is not a valid MySQL result resource
Is there another way to return the record count and get around the error produced if the results set is empty?