Hi everyone. I am unable to connect to my database I have set up. I have successfully connected to
my mysql database many times. This is why I am so shocked and stumped that I can't connect. I am
coding in php and I have checked all the common errors that I have had in the past - typos, forgot to list a variable, etc.
Now, though, I swear I have the correct name, password and anything else that I can control from what I see,
could someone suggest what I could do to start fixing this problem?
Thanks.
Here is what my webpage error reports:
I am unable to connect to the database because of: Access denied for user 'myrealusername'@'localhost' (using password: YES)
error_log:
PHP Warning: mysql_connect(): Access denied for user 'myrealusername' (using password: YES) in /home3/path/to/public_html/directory/submit.php on line 50
I put in parenthesis the 50th line in my code as it is referenced here.
Here is my code:
<?php
// databaseConnect();
if(isset($_POST['name'])){$name = $_POST['name'];}
if(isset($_POST['email'])){$email = $_POST['email'];}
if(isset($_POST['qor'])){$qor = $_POST['qor'];}
$db_hostname = "localhost"; //Host
$db_username = "username_here"; //Username
$db_pass = "password_here"; //Password
$db_name = "database_name"; //Database Name
$dbc=mysql_connect($db_hostname, $db_username, $db_pass, $db_name) or die ('I am unable to connect to the database because of: ' . mysql_error()); //(Line 50)
echo "connected to database" . "<br>";
$dbselect = mysql_select_db("tablename", $dbc) or die ('I am unable to find that table because of: ' . mysql_error());
Thanks for the help.
Randy