I am using hostgator to host my site. The code to code the database to the website is the following:
<?php
$pdo = new PDO('mysql:dbname=fashion;host=10.112.12.15', 'username', 'password');
/*the host part contains the IP address directing to my website.*/
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
?>
After executing the code, I get the following error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000][1045] Access denied for user '
I am wondering why the code is not working. But when I am in local and I use locahost
for the host, everything works perfectly.
Kindly help me solve this problem
Aucun commentaire:
Enregistrer un commentaire