MySQL Forums
Forum List  »  PHP

Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
Posted by: Dan Makovec
Date: August 08, 2005 05:47PM

To clarify, the reason I suspect a possible linkage is as follows:

In the bug I described, occasionally MySQL (4.1.11 at least, never seen it in 4.0.x) returns a "SELECT/INSERT/UPDATE/DELETE command denied" error to a perfectly valid query from a user with all the correct permissions. If you run the identical query again it probably runs fine.

Hence if, say for example in PHP, you have the following code...

------
$resultset = mysql_query("SELECT ...", $conn_id);

$rows= mysql_num_rows($resultset)
------

...and you're not checking that $resultset is valid, you'll get the warning described above.

To test this hypothesis, try changing the code to the following:
------
$resultset = mysql_query("SELECT ...", $conn_id);

if (!isset($resultset))
$rows= mysql_num_rows($resultset)
else
print "Error from MySQL: ".mysql_error($conn_id)."\n";

------

If the error turns out to be a permissions problem, but re-running the code works perfectly, post to some feedback to http://bugs.mysql.com/bug.php?id=11958

Options: ReplyQuote


Subject
Written By
Posted
August 10, 2005 10:15PM
October 26, 2005 04:35PM
October 26, 2005 04:38PM
January 14, 2006 03:43AM
September 08, 2005 02:08PM
Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
August 08, 2005 05:47PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.