how to do connectivity of 2 dbs in PHP script?

Answers were Sorted based on User's Feedback



how to do connectivity of 2 dbs in PHP script?..

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

how to do connectivity of 2 dbs in PHP script?..

Answer / naveen das

Simple using two connection objects

Is This Answer Correct ?    3 Yes 0 No

how to do connectivity of 2 dbs in PHP script?..

Answer / manjunath

mysql_query("select db names");

Is This Answer Correct ?    0 Yes 6 No

Post New Answer

More PHP Interview Questions

Apart from mail() function to send emails,is there any other functions in PHP to send emails?

4 Answers  


What is a php tag?

0 Answers  


What are PHP Magic Methods/Functions. List them.

0 Answers  


What is use of header() function in php?

0 Answers  


What is a query in php?

0 Answers  






i m a B.E,passed out few yrs bak failed to find good job due to less marks now thinkin of a career as PHP developer. is it a lucarative field and wat r career prospects; hv heard dat initial salary is very less bout 6k also most jobs r contrct jobs.pls guide me need ur valuable advice.pls hellppp!! thnx..

0 Answers   MNC,


What is an operator in php?

0 Answers  


How to do single and multi line comment in php?

0 Answers  


Explain how does one prevent the following warning ‘warning: cannot modify header information – headers already sent' and why does it occur in the first place?

0 Answers  


What is the difference between echo print and print_r in php?

0 Answers  


How to convert strings in hex format?

0 Answers  


What is the difference between abstract class and interface in php?

0 Answers  


Categories