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 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

How can we increase execution time of a php script?

883


What is lazy loading in php?

912


What the difference between the 'bitwise and' operator and the 'logical and' operator?

913


How to calculate the length of a string?

1023


What is php regular expression?

926


Which is incorrect with respect to separating php code and html?

949


What is difference between session_unset and session_destroy?

962


Is rent a variable cost?

898


How to calculate the difference between two dates using php?

987


How to specify argument default values?

931


How to support multiple-page forms?

914


how retrive the video file in php using video tag

1704


What is the difference between laravel and php?

879


Tell me is it possible to submit a form with a dedicated button?

904


Which is better php or nodejs?

907