diff --git a/models/Database.php b/models/Database.php index 3d5cb4c4..226cd749 100644 --- a/models/Database.php +++ b/models/Database.php @@ -306,9 +306,11 @@ class Database if (defined("DB_LOG_QUERIES") && DB_LOG_QUERIES) $this->logged_queries[] = $db_string; - $return = @mysqli_query($this->connection, $db_string, empty($this->unbuffered) ? MYSQLI_STORE_RESULT : MYSQLI_USE_RESULT); - - if (!$return) + try + { + $return = @mysqli_query($this->connection, $db_string, empty($this->unbuffered) ? MYSQLI_STORE_RESULT : MYSQLI_USE_RESULT); + } + catch (Exception $e) { $clean_sql = implode("\n", array_map('trim', explode("\n", $db_string))); trigger_error($this->error() . '
' . $clean_sql, E_USER_ERROR);