Re: Queries from two databases don't work

From: Date: Thu, 19 Jul 2007 07:59:04 +0000
Subject: Re: Queries from two databases don't work
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-43804@lists.php.net to get a copy of this message
Joaquín wrote:
Hello, I need query tables that are in two different databases so I use mysql_query() with link_identifier, as I've read in the manual, in order to select in wich DB must be made the query. The problem I have is that the link identifier has no effect. This example doesn't work <?php $conn_1=mysql_pconnect("localhost","usermysql","password"); mysql_select_db("DB1", $conn_1); $conn_2=mysql_pconnect("localhost","usermysql","password"); mysql_select_db("DB2", $conn_2); // <------ (1)
RTFM: http://php.net/mysql_pconnect To Quote: "First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection." You cannot open two database connections using _pconnect with exactly the same information. You need to use _connect and make sure you specify the $new_link parameter. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.db (#43804) next »