Not on the same server..

They have: 71 posts

Joined: Aug 2001

Hi, I have a database on one server - and a script that needs to call that database up on another. The script is for my site html-source.net and at the time I didn't think that I would need databasees so, I didn't pay for them. On my other site aGaj.org I have MySQL databases.

As you may know, I am writing a articles script and I need to host the actual script on HTML-Source.net but I need the information to be called from a database at aGaj.org.

Could someone please tell me how to do this..

Thanks,

Adam.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

First, make sure the host for aGaj.org allows mySQL connections from other than localhost. Most hosting companies restrict this to localhost for security reasons.

If they do allow connections from outside, it's a very simple change in your PHP connection code. (I'm assuming your using PHP)
$db_link = mysql_connect(HOST, USER, PASS)
or
$db_link = mysql_pconnect(HOST, USER, PASS)

HOST would could be "aGaj.org" or IP for it.

If your not using PHP, don't worry. Most languages require a HOST arguement.

Good Luck,

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 71 posts

Joined: Aug 2001

thanks for the help mark, and yes I'm using PHP sorry I should have said Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.