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

What are different types of errors available in Php?

493


Which function Returns the time of sunrise for a given day / location in PHP.

582


Write a php function to convert all null values to blank?

775


What are the method available in form submitting?

523


Tell me what is the main difference between require() and require_once()?

542






Do csrf tokens expire?

499


What are the advantages of triggers in php?

475


Why do we use htaccess

630


Write a program in php to check whether a number is prime or not?

494


How to store the uploaded file to the final location?

512


Xplain is it possible to use com component in php?

523


What is the use of inner join in mysql?

531


What is csrf token and why it is required?

534


What type of headers have to be added in the mail function to attach a file?

541


What is a http session?

537