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 to select a database in php?
Define metaphone()?
How to retrieve the original query string?
Which function is used in php to delete a file?
What is the difference between get and post method in php?
Which function is used in php to check the data type of any variable?
How can I increase my website session?
How do you use end in python?
How to join multiple strings into a single string?
What is nan value?
How to pass variables and data from php to javascript?
Why php script is not running in browser?
How to get number of days between two given dates using PHP?
Can we set session value in javascript?
What will the ?getdate() function returns in PHP?