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

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 Fast Name control panel.

  • 77 Users Found This Useful
Was this answer helpful?

Related Articles

How can I upload my MySQL database?

There are numerous ways to upload a MySQL database, we would strongly recommend trying methods 2...

What modules are installed on the server?

Simply log into your Fast Name Control Panel and select Web Diagnostics. Under that section you...

What version of PHP does Fast-name run?

You can find out the version of different programs that Fast-name run by logging into your Fast...

What is PHP?

Self-referentially short for PHP: Hypertext Preprocessor, an open source, server-side, HTML...

Can I place a PHP script in any directory I choose?

Yes. PHP scripts do not have to reside in any particular directory and will run anywhere in your...