phprockers-logo

How can we retrive value from one database server and store them another database server using php?

$db=mysql_pconnect("host","username","pssword"); 
mysql_select_db("dtabase name",$db); 
$query="select * from the table"; 
$res=mysql_fetch_object(mysql_query($query)); 
mysql_close($db);

//second Database
$db=mysql_pconnect("secondhost","username","pssword"); mysql_select_db("dtabase name",$db); 
$query="insert into tablename values($res)";
mysql_query($query); 
mysql_close($db);

0 comments:

Post a Comment