Update the constructor and $db connection handling in the groups and switch_settings classes.

This commit is contained in:
markjcrane
2016-04-14 22:38:28 -06:00
parent c2ecb23413
commit a6cd585315
2 changed files with 16 additions and 4 deletions

View File

@@ -16,9 +16,13 @@ class switch_settings {
* Called when the object is created
*/
public function __construct() {
//set the database connection
global $db;
$this->db = $db;
//connect to the database if not connected
if (!$this->db) {
require_once "resources/classes/database.php";
$database = new database;
$database->connect();
$this->db = $database->db;
}
}
/**