Queries from two databases don't work

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

 



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)

$result_t1 = mysql_query("SELECT *  FROM `Table1inDB1`",$conn_1);
$row_t1 = mysql_fetch_assoc($result_t1); // <------ (2)

$result_t2 = mysql_query("SELECT * FROM `Table2inDB2`",$conn_2);
$row_t2 = mysql_fetch_assoc($result_t2);
?>

It is as if (1) activates DB2 for all the script an in (2) the query is not made in DB1 but in DB2, even using $conn_1.

I have looking in php.ini but I haven't found anything useful.

My environment is php 4.4.2, mysql 4.0.18, IIS, W2000.

Thanks in advance.

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