MySQL Forums
Forum List  »  PHP

Re: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Posted by: Peter Brawley
Date: August 30, 2011 03:55PM

The mysql_query() call elicited an error, and your code failed to catch it. Minimal error trapping would be ...

$result = mysql_query("SELECT c.category_id, c.category_name, COUNT(photo_id) FROM gallery_category AS c LEFT JOIN gallery_photos AS p ON p.photo_category = c.category_id GROUP BY c.category_id") or exit( mysql_error() );

Better: write a try/catch block.

PB

Options: ReplyQuote


Subject
Written By
Posted
Re: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
August 30, 2011 03:55PM


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.