mirror of https://github.com/BOINC/boinc.git
Web: fix mysqli DB connection initialization
The mysqli class constructor returns an object even if the connection failed. The only way to find out about a connection failure is to call mysqli_connect_error() after the mysqli object was created. See: http://php.net/manual/en/mysqli.construct.php#refsect1-mysqli.construct-examples
This commit is contained in:
parent
3fc2d41f9a
commit
13a002cb8b
|
@ -41,6 +41,10 @@ class DbConn {
|
|||
} else {
|
||||
$this->db_conn = @new mysqli("p:".$host, $user, $passwd, $name, $port);
|
||||
}
|
||||
// mysqli returns an object even if the connection is not established
|
||||
if (mysqli_connect_error()) {
|
||||
return false;
|
||||
}
|
||||
global $mysqli;
|
||||
$mysqli = $this->db_conn;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue