Hi - wonder if anyone can help me. I've got an require() statement in a PHP script to bring in the MySQL database settings like this:
require("admin/news/db.php");
The following settings are in db.php:
$dbhost = "mysql.xcalibre.co.uk";
$dbuser = "username";
$dbpass = "password";
$dbname = "dbname";
(names have been changed to protect the innocent).
When I try and use those variables to connect to the database as below I get an error:
$db = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname,$db);
However if I hardcode the settings it works fine:
$db = mysql_connect("mysql.xcalibre.co.uk", "username", "password");
mysql_select_db("dbname",$db);
I don't experience this problem on my own local server (PHP 4.2.2), so I'm guessing it must be specific to the PHP version?
Any help would be greatly appreciated.