3
try create a file named db.php at your localhost and run it in browser to try out your db connection,the code are as follows. If problems exists, it will show the MySQL error message and at least you have an idea on what's getting wrong.
// connect to the server:
$cn = mysql_connect("localhost","username","pass");
// run a simple query
$sql = "SELECT 'done' as my_field LIMIT 1";
$result = mysql_query($sql,$cn);
if($result)
{
// if it worked, print the result to screen
echo mysql_result($result,"my_field");
} else {
// otherwise, either the server isn't running
// or the username/password are wrong
echo mysql_error()."
You should see an error message above you?";
}
?>