/** * Establishes a connection with the local database * * @return void */ public function dbConnect() { if ($this->_mysqli === null) { list($user, $pass) = $this->_config->getDBCredentials(); $this->_mysqli = new mysqli("localhost", $user, $pass); if ($this->_mysqli->connect_errno) { throw new Exception( 'Failed to connect to MySQL (' . $this->_mysqli->error . ')' ); } } }