$hostname='example.com';
$username='someUser';
$password='password';
$dbname='aDataBase';
$usertable='my_table';
mysql_connect($hostname,$username,$password);
@mysql_select_db($dbname) or die( "Unable to select database");
I’m using a read-only username here. When i test the script, i get the error “unable to select database”.
Any clue?
Don’t use fixed strings for your die() message…They’re useless for diagnosis. As well, don’t supress errors with
@.Using this you’ll get the exact reason things are failing.