<?php
class DbConn {
    public $dbh;
    private $_database;
    private $_user;
    private $_password;
    private $_host;
    private static $_instance = null;

    private function __construct(){
        $this->_database = '';
        $this->_user     = '';
        $this->_password = '';
        $this->_host 	 = '';
        $this->_connect();
    }

    public static function getInstance(){
      if( is_null(self::$_instance) ){
        self::$_instance = new self;
      }
      return self::$_instance->dbh;
    }

    private function _connect(){
        try{
            $connection = 'mysql:host='.$this->_host.';dbname='.$this->_database;
            $this->dbh = new PDO($connection, $this->_user, $this->_password);
            $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
        }catch (PDOException $ex){
			echo $ex->getMessage();
        }
    }

    private function __clone(){}
}