/** * Get the Database Connection * * @return Mysqli */ public static function getConnection() { if (!self::$_connection) { self::$_connection = @new mysqli(self::$_hostName, self::$_mysqlUser, self::$_mysqlPass, self::$_mysqlDb); if (self::$_connection->connect_error) { die('Connect Error: ' . self::$_connection->connect_error); } } return self::$_connection; }
private function __construct() { try { self::$_connection = new PDO("mysql:host={$this->_host};dbname={$this->_database}", $this->_user, $this->_password); if (defined("DEVELOPMENT_MODE")) { self::$_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); } } catch (PDOException $e) { var_dump($e); die; } }