class Db{
public static $_mysqli = null;
private $_host = "localhost",
$_database = "xxxxx",
$_username = "root",
$_password = "root";
public function __construct(){
//instace of db class
return $this->Connnect();
}
//method to connect to the db
public function Connnect(){
self::$_mysqli = mysqli_connect($this->_host,$this->_username,$this->_password,$this->_database);
//check for connection error
if(!mysqli_connect_errno()){
//no error
return self::$_mysqli;
}else{
echo "Connection Failed ". mysqli_connect_error();
}
}
}