set_charset("utf8"); self::$connection->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"); } // If connection was not successful, handle the error if (self::$connection === false) { // Handle error - notify administrator, log to a file, show an error screen, etc. return false; } return self::$connection; } /** * Fetch the last error from the database * * @return string Database error message */ public function error() { $connection = $this->connect(); return $connection->error; } }