For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2006 > Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
Martin Jay

2006-05-31, 9:57 pm

In message <1149122165.315881.191850@i40g2000cwc.googlegroups.com>,
macca <paulmcnally@hotmail.com> writes
>Hi, I am trying to display all the records from my table in an HTML
>table where the posted var $gallery_name.
>
>All i get is this error:
>
>Warning: mysql_num_rows(): supplied argument is not a valid MySQL
>result resource in
>/home/macca/public_html/somethingartistic/galleries/gallery.php on line
>60


I think you error is likely to be in the query. The PHP manual says:

"For SELECT, SHOW, DESCRIBE or EXPLAIN statements, mysql_query() returns
a resource on success, or FALSE on error.

[...]

mysql_query() will also fail and return FALSE if the user does not have
permission to access the table(s) referenced by the query."

> $query = "SELECT * FROM galleries WHERE artist_name =
>'$gallery_name'";
> $result = mysql_query($query, $dbh);

--
Martin Jay
Phone/SMS: +44 7740 191877
Fax: +44 870 915 2124
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com