Web Hosting Plus Logo



Web Hosting How-To Articles, Help and Information at Web Hosting Plus

How do I connect to another database on another server from my PHP script?

Back to Help Main Page

A connection is made to a database with the usual statement:

mysql_connect('localhost','USERNAME','PASSWORD');

Where 'localhost' is the database on the same web server as the PHP script.

If you want to connect to a database to another web server you would replace localhost' to that of the IP address of the web server.

The web server where a database resides can be found by moving your mouse over the "Go" link for the Temp Web Address or clicking the link so the IP is displayed in the browser address bar, within the Web Hosting Plus control panel.


This is in reply to:

How do I connect to another database on another server from my PHP script?


Web Hosting Plus Help Main Page