Connecting to a DB on a different server than the PHP file
Posted: Tue Nov 07, 2006 1:30 pm
I have wrote a PHP script that connects to a MySQL server on another IP address but it trying to connect to localhost still. The script is as follows:
But I receive the following error:
Regards,
Code: Select all
mysql_connect("x", "x", "x");
mysql_select_db("x");
$query = mysql_query("SELECT * FROM x");
while ($results = mysql_fetch_array($query)) {
echo $results['id'], "<br>";
echo $results['fName'], "<br>";
echo $results['sName'], "<br>";
}Stesbox.co.uk is my own box that the PHP file is running on. Can someone advise my of what I've done wrong here please?PHP Warning: mysql_connect(): Access denied for user 'database'@'stesbox.co.uk' (using password: YES) in /var/www/html/php/test/db.php on line 3
Regards,