I have this code:
$rows = array(); $res = mysql_query($someQuery); if(!mysql_errno()) while($row = mysql_fetch_assoc($res)) $rows[] = $row;
$someQuery is an arbitrary query that I write to the form. Mysql_errno catches the case when I write a mysql query with errors in it. But I just found that when I make the query "Delete from table_name", this is certainly not an error, but at the same time mysql_fetch_assoc fails with the argument "Warning: mysql_num_rows (): the supplied argument is not a valid MySQL resource result in /blah/blah/file.php on line x ".
I tried to find it in the manual (maybe I'm just blind), but is there a function I can use to check if $ res is a valid MySQL result resource or not?
php mysql resultset
Svish
source share