/** * Define the default mysql connection to be used for this object. * @param mysqli object $mysqli_connection * @throws Exception */ public static function setMySqlConnection($mysqli_connection) { if (!is_a($mysqli_connection, 'mysqli') || $mysqli_connection->connect_errno) { throw new Exception("Failed to connect to MySQL: (" . $mysqli_connection->connect_errno . ") " . $mysqli_connection->connect_error); } self::$mysqli_connection = $mysqli_connection; }