Re: AGONIZING Mysql Select DB issue.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/
---------------------------------------------------------------------------

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux