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
[EMAIL PROTECTED]                             http://www.purplecow.com/
---------------------------------------------------------------------------

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to