how to do connectivity of 2 dbs in PHP script?

Answer Posted / lt

If you are trying to open multiple, separate MySQL
connections with the same MySQL user, password, and
hostname, you must set $new_link = TRUE to prevent
mysql_connect from using an existing connection.
The workaround is to require that the second MySQL
connection is new:

$db1 = mysql_connect($dbhost, $dbuser, $dbpass);
$rv = mysql_select_db($dbname1, $db1);
$db2 = mysql_connect($dbhost, $dbuser, $dbpass, TRUE);
$rv = mysql_select_db($dbname2, $db2);
Source: http://jp2.php.net/manual/en/function.mysql-connect.php
Message from: arithmetric at gmail dot com
26-Mar-2008 03:59

Is This Answer Correct ?    16 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is php better than java?

547


Write a hello world program using variable?

543


Which php framework is fastest?

512


What is the difference between die () and exit () in php?

515


How to convert strings to upper or lower cases?

564






Why did you choose this particular career path?

8356


What is htmlentities function in php?

512


Explain how to run the interactive php shell from the command line interface?

556


What is data type in php?

528


How can you tell if a number is even or odd without using any condition or loop?

525


What does PEAR stands for?

645


How many ways to include array elements in double-quoted strings using php?

564


Why should I store logs in a database rather than a file?

536


How easy is php?

526


Write an example to remove html tags from a string in php?

523