Skip navigation links

MySQL Forums :: PHP :: mysql_fetch_array(): supplied argument is not a valid MySQL result resource


Advanced Search

mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Posted by: John Morlock ()
Date: August 30, 2011 01:49PM

I am running:
Apache/2.2.19 (Win32) PHP/5.2.17
MySQL client version: 5.0.51a

on a Windows 7 system at home. I have written a web site with about 20 pages of PHP code. Everything works great on my server at home, but, as soon as I upload my pages to the web server, I get the
mysql_fetch_array(): supplied argument is not a valid MySQL result resource
error. The server is running:
Server: Localhost via UNIX socket
Server version: 5.0.92-community
Protocol version: 10
cpsrvd 11.28.93
MySQL client version: 4.1.22
PHP extension: mysql

The code that the error message points to is:

if(empty($cid) && empty($pid)) {
$number_of_categories_in_row = 4;

$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");
echo $result;
while( $row = mysql_fetch_array($result) )

This is code I got from: http://www.sitepoint.com/php-gallery-system-minutes/.

Since everything works great on my personal server, I guess my question is, does mysql_fetch_array() not work on the web servers version of software or what else might the problem be?

Options: ReplyQuote


Subject Written By Posted
mysql_fetch_array(): supplied argument is not a valid MySQL result resource John Morlock 08/30/2011 01:49PM
Re: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Peter Brawley 08/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.