Home » Categories » Multiple Categories

How do I use PHP to connect to another database on another server?

When you make a connection to a database, you use the usual statement:

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

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

If you need to connect to a database that is on another server, you would replace localhost with the IP address of the server.

You can find the IP address of the database’s server by checking your eXtend Control Panel.

  1. Log into your eXtend Control Panel
  2. Click on ‘MySQL Databases’
  3. Scroll down to the existing databases
  4. Copy the IP address next to the database you require
  5. Paste that IP address into your mysql_connect line
1 (1)
Article Rating (1 Votes)
Rate this article
  • Icon PDFExport to PDF
Related Articles
How do I upload a CGI script into my hosting account?
Added on Mon, Mar 16, 2015
What is PHP?
Added on Fri, Mar 13, 2015
What is JavaScript?
Added on Fri, Mar 13, 2015
Where is the dictionary directory?
Added on Mon, Mar 16, 2015
What is Java and what can it do?
Added on Fri, Mar 13, 2015