Re: AGONIZING Mysql Select DB issue.

From: Date: Sat, 16 Aug 2003 04:23:57 +0000
Subject: Re: AGONIZING Mysql Select DB issue.
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-29915@lists.php.net to get a copy of this message
If you are doing this: $dbh = mysql_connect("db1", blah blah blah); $dbh2 = mysql_connect("db2", blah blah blah); Then $r = mysql_query("select * from mytable"); will use the db2 connection, because it is the most recent. However, if you do this: $r = mysql_query("select * from mytable", $dbh); it will use the first connection, as specified in the handle that is passed back by mysql_connect. mysql_query uses the most recent connection by default; you can override this action by specifying which DB handle to use for a given query. Replace $dbh with $dbh2 to select from tables on the second database. Peter On Fri, 15 Aug 2003, Thomas Deliduka wrote: > Here's the stats: > > Two servers: > > Server 1, Mysql 4.0.12, PHP 4.3.2, apache 1.3.27 > Server 2, Mysql 4.0.14, PHP 4.3.2, apache 1.3.27 --------------------------------------------------------------------------- Peter Beckman Internet Guy beckman@purplecow.com http://www.purplecow.com/ ---------------------------------------------------------------------------

« previous php.db (#29915) next »