NYCPHP Meetup

NYPHP.org

[nycphp-talk] different sites, one database

Henry Ponce henry at beewh.com
Wed Jul 13 11:15:17 EDT 2005


Hello all:

I've been trying to solve this on my own with no luck. I can't seem to find 
the answer on google. I get different problems/solutions but not the answer 
to what I want to do. Maybe someone here can help me or point me in the right 
direction.

Here's what I need to do... 

I have a dedicated server with different sites hosted, each with their own 
mysql database which I connect to perfectly in my php scripts, using 
"localhost" as the server in the mysql_connect() function.

The sites are for example...site1.com, site2.com, site3.com.

Well, now I need to connect to a mysql database on site1.com that holds 
information that is usefull and needed for most sites. I need to do this on 
scripts that run on site2.com and site3.com.

How can I connect to the mysql database on site1.com, when I am running a 
script on site2.com or site3.com?

I can't use "localhost" as the server in the mysql_connect() function in the 
scripts on site2.com or site3.com, because I would be connecting to the mysql 
database, on each site, which I understand. 

Help!!

Thank you in advance and I hope my explanation was clear.

Henry



More information about the talk mailing list