php - unable to connect mysql db with this code -
$hostname='example.com'; $username='someuser'; $password='password'; $dbname='adatabase'; $usertable='my_table'; mysql_connect($hostname,$username,$password); @mysql_select_db($dbname) or die( "unable select database");
i'm using read-only username here. when test script, error "unable select database".
any clue?
don't use fixed strings die() message...they're useless diagnosis. well, don't supress errors @
.
mysql_connect($hostname,$username,$password) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error());
using you'll exact reason things failing.
Comments
Post a Comment