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
Explain what does the unlink() function means?
Does wordpress run on php 7?
What is basename php?
Code to upload a file in PHP?
What is artisan in php?
How to check if a string contains a character or word in php?
How to execute an sql query?
How to get number of elements in an array?
What is the timeout period on session values?
Whether php supports microsoft sql server?
Tell me what is the use of the function htmlentities?
How to get best php developer Experience in Php with Sugar CRM / VTiger.
Tell me when a conditional statement is ended with an endif?
What is the difference between explode () and split () functions in php?
Which function is used to strip whitespace?