Insert Data into 2 different databases (MySQL)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Maluendaster
Forum Contributor
Posts: 124
Joined: Fri Feb 25, 2005 1:14 pm

Insert Data into 2 different databases (MySQL)

Post by Maluendaster »

Hi all, i was wondering if you can help me out on this.. I run a site and the users can register to our mailing list, but for example, if i have a site in http://www.site1.com (with a mysql database), and another site in http://www.site2.com (also with a mysql), and the form is in site1.com, and I want to insert the data of the users in the databases from site1.com and site2.com, how do i do that?? thank you very much for any help..
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The connect method of your database extension probably has a parameter called server. Just pass the name or ip of the server you want to connect to. The server might be configured not to allow this but it's worth a try.
Maluendaster
Forum Contributor
Posts: 124
Joined: Fri Feb 25, 2005 1:14 pm

Post by Maluendaster »

volka wrote:The connect method of your database extension probably has a parameter called server. Just pass the name or ip of the server you want to connect to. The server might be configured not to allow this but it's worth a try.
thanks, but can you be a little more specific please? ..
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

instead of mysql('localhost'... try mysql_connect('name_or_ip_of_the_other_server'...
Maluendaster
Forum Contributor
Posts: 124
Joined: Fri Feb 25, 2005 1:14 pm

Post by Maluendaster »

volka wrote:instead of mysql('localhost'... try mysql_connect('name_or_ip_of_the_other_server'...
thanks, ill try that.
Post Reply