How can I retrieve values from one database server and
store them in other database server using PHP?



How can I retrieve values from one database server and store them in other database server using P..

Answer / mahesh

$db1 = mysql_connect(”host”,”user”,”pwd”)
mysql_select_db(”db1name;, $db1);
$res1 = mysql_query(”query”,$db1);


$db2 = mysql_connect(”host”,”user”,”pwd”, true)
mysql_select_db(”db2name;, $db2);
$res2 = mysql_query(”query”,$db2);

So mysql_connect has another optional boolean parameter
which indicates whether a link will be created or not. as we
connect to the $db2 with this optional parameter set to
‘true’, so both link will remain live.

now the following query will execute successfully.
$res3 = mysql_query(”query”,$db1);

Is This Answer Correct ?    8 Yes 2 No

Post New Answer

More PHP Interview Questions

How many ways you can delete a session variable ?

6 Answers  


i want to store retrieved data from database into an array list with limit.And display the data from that array list.have any answer for this?

2 Answers  


List data types in PHP?

0 Answers  


Give small demo of writting OOP in PHP-mysql.

1 Answers   TCS,


How do http requests work?

0 Answers  






Tell us how to redirect a page in php?

0 Answers  


How to return a value back to the function caller?

0 Answers  


Do while loops php?

0 Answers  


Do loops php?

0 Answers  


Explain the three different kinds of Arrays?

0 Answers  


How can image properties be retrieved in php?

0 Answers  


Can php run on windows server?

0 Answers  


Categories