Close the mysqli connection when deleting the class.

This commit is contained in:
Will Rossiter 2014-03-16 16:53:13 +13:00 committed by Ingo Schommer
parent 2beb1631a5
commit 912cda9a1e

View File

@ -67,7 +67,7 @@ class MySQLDatabase extends SS_Database {
} else {
$this->dbConn = new MySQLi($parameters['server'], $parameters['username'], $parameters['password']);
}
if($this->dbConn->connect_error) {
$this->databaseError("Couldn't connect to MySQL database | " . $this->dbConn->connect_error);
}
@ -86,6 +86,12 @@ class MySQLDatabase extends SS_Database {
}
}
public function __destruct() {
if($this->dbConn) {
mysqli_close($this->dbConn);
}
}
/**
* Not implemented, needed for PDO
*/