Re: Invalid MySQL result resource

From: Date: Thu, 13 Sep 2001 04:49:46 +0000
Subject: Re: Invalid MySQL result resource
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67124@lists.php.net to get a copy of this message
On Thu, 13 Sep 2001 13:53, Dan Harrington wrote: > Hello, > > What is the best way to accomplish the following?: > > Connect to MySQL database > Execute a query > > Fetch a row from that query (mysql_fetch_array) > Based on the data from the original query, generate a second query > Execute the second query > Fetch a row from the second query (mysql_fetch_array) > > Fetch another row from the first query (mysql_fetch_array) > Based on the data from the original query, generate a second query > Execute the second query > Fetch a row from the second query (mysql_fetch_array) > > ...etc, until I have processed all the rows in the original query. > > I am attempting to do this, and keep getting > > "Supplied argument is not a valid MySQL result resource in ..... on > line 52" > > Line 52 is the line where I fetch the row from the second query. > > Is there a rule I am violating? I've read the manual, searched online > databases, etc etc and I don't find anything. I've done this with > other SQL databases and PHP, is there something special about MySQL > that I am not aware of? That usually indicates that the query which produced the resource failed for some reason. Immediately after the mysql_db_query(s), use mysql_error to fetch the error message from mysql. This _used_ to be in the FAQ, I swear :-) -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Psychiatrists stay on your mind.

« previous php.general (#67124) next »