Wednesday, 7 June 2017

php - MySQL access denied error but everything is correct!



Here's my code



$host = 'localhost';
$username = 'sam_sam';
$password = '[censored]';
$name = 'sam_ballpointradio';

mysql_connect($host, $db_username, $db_password)
or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
?>


and the error message is




Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'sam'@'localhost' (using password: NO) in /home/sam/public_html/ballpointradio/db_config.php on line 6
Access denied for user 'sam'@'localhost' (using password: NO)





I know all the information is correct, but it's a weird error because it says I'm NOT using a password, but I am...


Answer



Variable naming problem ?



mysql_connect($host, $username, $password)

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...