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 to add different images in php program like a job site.......

2 Answers  


How many types of array are there in php?

0 Answers  


Explain the visibility of the property or method?

0 Answers  


How to replace a text in a string with another text in php?

0 Answers  


Can age be a variable?

0 Answers  


What is the difference between fopen() and fclose()?

0 Answers  


Which one is best framework for php?

0 Answers  


Is php closing tag necessary?

0 Answers  


Can we run php in apache tomcat?

0 Answers  


What is the function file_get_contents() usefull for?

0 Answers  


Which is correct about mysqli and pdo?

0 Answers  


What is the use of get and post method in php?

0 Answers  


Categories