Hi Guys, I'm using this code to establish database connection inside a class to get access from my database
But, it's not giving me expected result.
PHP Code:
<?php

namespace lib\config
{
    
/*
     * @PDOConfig is class containg all the neccery information
     */
    
use PDO;
    class 
PDOConfiges extends PDO 
    
{
       
/*
        * 
        */
        
private $link,$db,$database,$host,$id,$pwd,$error;
        
        private function 
init()
        {
            
$this->db='mysql';
            
$this->dbname='lib';
            
$this->host='localhost';
            
$this->id='root';
            
$this->pwd=''//database Password Here    
        
}
        public function 
__construct()
        {
            
/*
             * Calling @init() to initilize the value
             */
            
            
$this->init();           
            
/*
             * Calling the Constructor of @PDO
             * //
             */
            
            
$this->conn=  parent::__construct($this->db.':dbname='.$this->dbname.';host='.$this->host,$this->id,$this->pwd) or die($this->error="Invalid Configration"); 
           echo 
"running";
        }
        public function 
erro()
        {
            if(isset(
$this->error))
            {
                if(!empty(
$this->error))
                {   
                      echo 
"<b>".$this->error."</b>";
               }
            }
        }
    }
    
}

$pdo = new \lib\config\PDOConfiges;
$pdo->erro();
The Output is:
Invalid Configration
My Configration is right but still it it is generating this. tell me how can i establish the connection?