Re: Multiple SQL queries

From: Date: Thu, 15 Jan 2004 17:34:33 +0000
Subject: Re: Multiple SQL queries
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-32411@lists.php.net to get a copy of this message
Arthur Pelkey wrote:
I am new this. I have a page that has multiple queries on it, I want to do doing the following: Query a mysql db multiple times in the same page, but i must be missing something, I keep getting these AFTER the first queryis successful: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /path/php_file.php on line line_number Can someone point in the right direction on how to do multiple queries, some are not querying the same db btw. -Art
You need to make sure that you use your statement handles and connection handles so that the functions use the correct connection and such. Of course, that's a pain, so.... You could try using a Database Abstraction class, such as PEAR's DB to help a bit with this. Even easier, though, is to use something like DB_DataObject which encapsulates all of this for you AND gives you a handy place to store all of the data. PEAR::DB http://pear.php.net/package/DB PEAR::DB_DataObject http://pear.php.net/package/DB_DataObject -- paperCrane <Justin Patrin> -- Question Everything, Reject Nothing

« previous php.db (#32411) next »