How can I retrieve values from one database server and
store them in other database server using PHP?
Answer Posted / 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 View All Answers
What is the difference between explode () and split () functions in php?
How to remove duplicate values from array using php?
Differentiate between php5 and php7?
What is a null coalescing operator in php7?
How can we check the value of a given variable is a number?
Explain about PHP filter and why it should be used?
Tell me how is it possible to know the number of rows returned in result set?
How to get no. of rows using MYSQL function?
What is difference between count or sizeof function in php?
What software is required to run php?
What is inheritance in php with example?
What are the different tables(engine) present in mysql, which one is default?
How to Pass JSON Data in a URL using CURL in PHP?
Is null function in php?
How to increase the execution time of a PHP script?