Commit 525dc21d authored by Alexander Butenko's avatar Alexander Butenko

Correctly handle mysql connection errors

parent 09f36df7
......@@ -210,8 +210,9 @@ class MysqliDb
if (empty ($this->host))
die ('Mysql host is not set');
$this->_mysqli = new mysqli ($this->host, $this->username, $this->password, $this->db, $this->port)
or die('There was a problem connecting to the database');
$this->_mysqli = new mysqli ($this->host, $this->username, $this->password, $this->db, $this->port);
if ($this->_mysqli->connect_error)
throw new Exception ('Connect Error ' . $this->_mysqli->connect_errno . ': ' . $this->_mysqli->connect_error);
if ($this->charset)
$this->_mysqli->set_charset ($this->charset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment