Re: Queries from two databases don't work

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

 



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/

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