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

Answer Posted / sunilchai

just connect to the datbase server from php using the
mysql_connect and store the connection identifier in a
variable and then fetch the data from the server and the
close the server connections using mysql_close() and then
connect to another server and insert the value there

/// sample scriopt

$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);

///connected to the first server fetch the data and stored
in the $res varialble


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

Is This Answer Correct ?    9 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what's the difference between include and require?

622


What’s the special meaning of __sleep and __wakeup?

637


How do you end php?

606


What is a php trait?

569


Why php is better?

627






How do you end a session in php?

632


Why php is also called as scripting language?

618


Why overriding is called runtime polymorphism?

609


What is T_PAAMAYIM_NEKUDOTAYIM?

762


What is difference between include,require,include_once and require_once()?

607


What does a delimiter do in mysql?

629


What are the different types of php variables?

675


How to download files from an external server with code in php?

574


What is difference between include and include_once in php?

576


How are php sessions stored?

618