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
How many types of php frameworks are there?
What is the difference between array_map () and array_shift ()?
Explain about PHP filter and why it should be used?
What is php and its features?
What is the use of mysqli_real_escape_string() function?
Which have the fastest execution between mysql_fetch_array() and mysql_fetch_assoc()
How failures in execution are handled with include() and require() functions?
Code to open file download dialog in PHP?
Explain the advantages of using PHP?
How to include a file to a PHP page?
What are the advantages of stored procedures, triggers, indexes in php?
How can image properties be retrieved in php?
How can you get the size of an image in PHP?
A process can run only in the background. State Whether True or False?
Tell me what should we do to be able to export data into an excel file?