hello everyone,
I am having some difficulty setting up a connection to my database. I created one on godaddy but am unable to get past this one hump:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)' in /home/badinvestor/public_html/config/connection.php:9
Stack trace:
#0 /home/badinvestor/public_html/config/connection.php(9): PDO->__construct('mysql:host=loca...', 'root', '')
#1 /home/badinvestor/public_html/classes/registration.php(45): connect_db()
#2 /home/badinvestor/public_html/views/register.php(20): registration->get_schools()
#3 /home/badinvestor/public_html/register.php(10): require_once('/home/badinvest...')
#4 {main}
thrown in /home/badinvestor/public_html/config/connection.php on line 9
My line 9 connection is as follows:
// database info
define('HOST','localhost');
define('DB','qbank');
define('USER','registration');
define('PASS','register');
function connect_db()
{
$db = new PDO('mysql:host='.HOST.';dbname='.DB,USER,PASS);
return $db;
}
Please note that I already used 'root' and '' as username and password respectively with no luck so I created this as a test user... Looking up online for people with similar problems didn't really turn out to be helpful.
Any thoughts?
Thank you,
come_again