How can I retrieve values from one database server and
store them in other database server using PHP?
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 |
What is the difference between include and include_once ? Which is one is good in terms of performance ?
What is empty php?
How is the ternary conditional operator used in php?
Explain how to submit form without a submit button.
How can I use single quotes in single quotes in php?
what is this error "Call to unsupported or undefined function mysql_connect();" and when you will get this?
What are the advantages of indexes?
Is python easier than php?
What’s the difference between sort(), assort() and ksort? Under what circumstances would you use each of these?
How can we increase the execution time of a PHP script?
12 Answers CyberBeoz, Photon, XTX,
How can we determine whether a variable is set?
How to write in a file in php?