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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]