public static function getCon() { if (self::$con == null && self::$db == null) { self::$db = new Database(); self::$con = self::$db->connect(); } return self::$con; }
/** * * Get the connection Reference statically * * @global array $config Global Config from config file * @return MySQLi Connection */ public static function getCon() { if (Database::$con == null) { global $config; Database::$con = new mysqli(Core::GetConfig("db_host"), Core::GetConfig("db_user"), Core::GetConfig("db_password"), Core::GetConfig("db_db")); if (Database::$con->connect_error) { die('Connect Error (' . Database::$con->connect_errno . ') ' . Database::$con->connect_error); } } return Database::$con; }
public function disconnect() { self::$con = null; }