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?

Answers were Sorted based on User's Feedback



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

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

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

Answer / sunilchai

Hi Bharat your answer will work if we have low values but I
had come across the situation where I need to connect to
msaccess database where it has nearly 10000 records need to
fetch the records and insert in mysql.Keeping all the
sensitive info in the sessions will exceed the server
session memory


thanks and regards,
sunilchai

Is This Answer Correct ?    2 Yes 3 No

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

Answer / bharat

Another option is :
we can stored all values in sessions of one database.
and these sessions values insert in to another database.

Is This Answer Correct ?    2 Yes 6 No

Post New Answer

More PHP Interview Questions

What does odbc do in context with php?

0 Answers  


What is foreach loop in php?

0 Answers  


Explain what is smarty?

0 Answers  


What is php destruct?

0 Answers  


How to get complete current page url in php?

0 Answers  


What do you mean range() in php?

0 Answers  


What do you mean by core php?

0 Answers  


What is mysqli_query?

0 Answers  


Explain me differences between get and post methods?

0 Answers  


How do I escape data before storing it into the database?

0 Answers  


How to block direct directory access in PHP?

0 Answers  


what is the diference between php4 and php5

2 Answers   Tavant Technologies,


Categories