Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How can I retrieve values from one database server and store
them in other database server using PHP?

Answers were Sorted based on User's Feedback



How can I retrieve values from one database server and store them in other database server using PH..

Answer / vijaya

we can always fetch from one database and rewrite to
another. Here is a nice solution of it.

$db1 = mysql_connect(”host”,”user”,”pwd”)
mysql_select_db(”db1&#8243;, $db1);
$res1 = mysql_query(”query”,$db1);
$db2 = mysql_connect(”host”,”user”,”pwd”)
mysql_select_db(”db2&#8243;, $db2);
$res2 = mysql_query(”query”,$db2);At this point you can only
fetch records from you previous ResultSet,

i.e $res1 - But you cannot execute new query in $db1, even
if you supply the link as because the link was overwritten
by the new db.so at this point the following script will fail

$res3 = mysql_query(”query”,$db1); //this will failSo how to
solve that?

Take a look below.

$db1 = mysql_connect(”host”,”user”,”pwd”)
mysql_select_db(”db1&#8243;, $db1);
$res1 = mysql_query(”query”,$db1);

$db2 = mysql_connect(”host”,”user”,”pwd”, true)
mysql_select_db(”db2&#8243;, $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 ?    14 Yes 4 No

How can I retrieve values from one database server and store them in other database server using PH..

Answer / ravinder

by using import and export

Is This Answer Correct ?    1 Yes 15 No

Post New Answer

More PHP Interview Questions

Is it possible to destroy a cookie?

0 Answers  


How we can convert dynamic url into static url? plz provide code.

2 Answers   Xento,


Explain about getters and setters in php?

0 Answers  


Write a program to find a string is palindrome or not?

0 Answers  


What is the purpose of basename() function in PHP?

0 Answers  


What is singleton design pattern in php?

0 Answers  


can any one tell how to install LAMP server in terminal in ubuntu.....and also tell please how to run php files in ubunut and how to save and compile in ubuntu..i already installed ubuntu ..but i dont installed lamp server so i want to install lamp server in terminal is it possible please reply

2 Answers  


What is api example?

0 Answers  


how prepare the testing documentation.

0 Answers   Accenture,


What's diffrence between Get() and Post() Function

7 Answers  


when we select some checkboxes and we went for next page if we came back to prevoius page the selcted checkboxe should be checked

2 Answers  


what is output of echo 1< 2 and echo 1 >2

8 Answers   HCL, Navigators Software,


Categories