mysql_connect problem
Posted by: sherpa
Posted on: 2005-10-12 09:37:00
I'm trying to connect to mysql by reading hostname, username, and password from an .inc file, but, I'm having a little difficulty.
If I connect using the following format:
$host = 'mysql.mydomain.com';
$user = 'username';
$pass = 'password';
$name = 'dbname';
$db = mysql_connect($host,$user,$pass);
mysql_select_db($name,$db);
...I get access denied error. But, If I connect using the code below:
$host = 'mysql.mydomain.com';
$user = 'username';
$name = 'dbname';
$db = mysql_connect($host,$user,'password');
mysql_select_db($name,$db);
...it works.
So, the code breaks if I use the variable $pass. I made sure that $pass has the right value with no leading or trailing spaces. Please help. Thank you.