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
Explain array_uintersect()?
What is a persistent cookie in php?
Explain what is the function file_get_contents() usefull for?
Which is the latest version of php?
How to support multiple-page forms?
What is form action php?
Which have the fastest execution between mysql_fetch_array() and mysql_fetch_assoc()
What is php used for?
How to get no of arguments passed to a PHP Function?
What is php? Why it is used?
How the values are ordered in an array?
What are the advantages of php?
Explain me what are the 3 scope levels available in php and how would you define them?
What are php libraries?
How to run the interactive php shell from the command line interface?