Log in

View Full Version : how to send the datebase value from one server to other server



purnendu2311
05-02-2007, 12:23 PM
Hi all ,

I have one form, using this form, i am sending the data to one database server.
After sending the data, i want to send the information to other server(second server). how to do can anybody will help.

Thanks and regards

Ranjan

thetestingsite
05-02-2007, 04:46 PM
Do you mean you want to send to 2 different database servers, or do you want to send to one database server and then some script on a different server? If the first, simply make 2 sepearte sql connections (one after the other) and send the query like that. An example (using MySQL):



<?php

//open the connection to 2 database servers
$conn = mysql_connect("server1.host.com", 'username', 'password');
$connection = mysql_connect("server2.host.com', 'username', 'password');

//select the databases
mysql_select_db('db1', $conn);
mysql_select_db('db2', $connection);

//execute the query
mysql_query("INSERT INTO `table` VALUES ('null','1234')", $conn);
mysql_query("INSERT INTO `table2` VALUES ('null','1234')", $connection);

//close the connection
mysql_close($conn);
mysql_close($connection);

?>


Hope this helps.

cr0w
05-02-2007, 10:53 PM
If you mean from one server(www.example.com) to another(www.example2.com), then you'd have to talk to your host(s) about doing that, although i highly doubt they'll allow it, considering that would be a big security risk.

exipnos
05-06-2007, 08:40 AM
but he could redirect to www.example2.com from www.example1.com.
in www.example2.com - insert data
and goback www.example1.com - insert data
???:)