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 register website in internet

2 Answers  


What are the uses of implode() function?

0 Answers  


How do you check if an arraylist is empty?

0 Answers  


What are the different loops in php?

0 Answers  


What is htaccess? Why do we use this and where?

0 Answers  






How to uploaded files to a table?

0 Answers  


What are the environmental variables?

0 Answers  


hey i m a trainee n jus wanted to ask that initially i was given the opportunity for .NET bt that project is abt to complete , nw i m asked to join a project of php on linux which is about to start , so wt say . is it a wise decision to join this project . will i be having job opportunities when i l complete my training after 4 months ? Plz suggest something ASAP .

1 Answers  


When to use single quotes, double quotes, and backticks?

0 Answers  


How to get a total number of rows available in the table?

0 Answers  


What is put method in php?

0 Answers  


What are the differences between procedure-oriented languages and object-oriented languages?

6 Answers   ASD Lab, DewSoft,


Categories