I have a PHP script that looks like this:
$link = mysqli_connect("localhost", "gateway7_make", "$PASSWORD$");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("Host information: %s\n", mysqli_get_host_info($mysqli));
}
And this script consistently outputs
Connect failed: Access denied for user 'gateway7_make'@'localhost' (using password: NO)
Unless I use my webhost password, in which case it outputs
Connect failed: Access denied for user 'gateway7_make'@'localhost' (using password: YES)
Trying to use “root@localhost” gives me the same message as above.
I know the username and password are valid, because they work with phpmyadmin installed on the same machine.
The script, the mysql server, and phpmyadmin are all on the same Hostmonster server.
Could anyone tell me what I’m doing wrong?
The error was that my password contained a “$”, and wasn’t surrounded by the proper single quotes.
Thank you all for your assistance and time.