Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Ialreadymakeconnectionwithdatabasebutstillcomeoutwiththiserrorcananyoneteachme

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\notification\dbconn.php:11 Stack trace: #0 C:\xampp\htdocs\notification\dbconn.php(11): PDO->__construct('mysql:host=loca...', 'root', '123456', Array) #1 C:\xampp\htdocs\notification\sql.php(5): dbconn->initDBO() #2 C:\xampp\htdocs\notification\login.php(9): sql->__construct() #3 {main} thrown in C:\xampp\htdocs\notification\dbconn.php on line 11

Source code:

<?php class dbconn {

        public $dblocal;
        public function __construct()
        {

        }
        public function initDBO()
        {
            $this->dblocal = new PDO('mysql:host=localhost;dbname=notifikasi;charset=latin1','root','123456',array(PDO::ATTR_PERSISTENT => true));
            $this->dblocal->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); 

        }}?>

Comments