diff --git a/html/inc/db.inc b/html/inc/db.inc
index aec1d50c351..5ff55229994 100644
--- a/html/inc/db.inc
+++ b/html/inc/db.inc
@@ -48,6 +48,9 @@ if (MYSQLI) {
$port = null;
}
$mysqli = @new mysqli($host, $user, $pass, $dbname, $port);
+ if ($mysqli->connect_errno) {
+ return null;
+ }
return $mysqli;
}
function _mysql_query($q) {