Connecting to more than 2 databases from a single PHP script.

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

 



Hello,

In a single PHP code, I want to connect to two mysql databases with
totally different authentication information. Is it possible?

Right now snippet of my code looks something like this:
<?php
.....
$conn_1=mysql_connect('host1','user1','pass1');
$conn_2=mysql_connect{'host2','user2','pass2');
$db_list = mysql_list_dbs($conn_2);

while ($row = mysql_fetch_object($db_list)) {
echo $row->Database . "\n";
}
?>

However when I try to list all the databases in host2, it instead lists
the database in host1.
host1 and host2 are different machines and the databases in each of them
are entirely different.

I read that the new_link parameter might be used here but I couldnt figure
out how to do that.

I am new to PHP...so any help would be great!!

-suamya.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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