diff --git a/resources/classes/groups.php b/resources/classes/groups.php index b3dd5e9f47..48848b47cf 100644 --- a/resources/classes/groups.php +++ b/resources/classes/groups.php @@ -34,11 +34,19 @@ */ class groups { + public $db; + /** * Called when the object is created */ public function __construct() { - //place holder + //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; + } } /** diff --git a/resources/classes/switch_settings.php b/resources/classes/switch_settings.php index 29ebf827f9..d60c4c6c21 100644 --- a/resources/classes/switch_settings.php +++ b/resources/classes/switch_settings.php @@ -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; + } } /**