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

Tell me what is the use of the function htmlentities?

992


write a prog using insert,update,delete in this manner as output? name: phno. add button 1.name phno. edit button delete button 2.

2058


Which of the delimiter is ASP style?

1129


Write a program to find the factorial of a number in php?

1038


Which is best framework for php?

1063


Do you know what are traits?

1066


in PHP for pdf which library used?

1065


What is move_uploaded_file in php?

1027


Does php have block scope?

1011


Explain how to submit form without a submit button.

1001


What's the difference between using mysql_ functions and pdo?

1249


How to redirect a page in php?

1061


What does the scope of variables means?

1057


What is default session time in php?

1022


What are global variables in php?

993