Browse Source

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

markjcrane 9 years ago
parent
commit
7c4e437f47
1 changed files with 9 additions and 1 deletions
  1. 9 1
      resources/classes/groups.php

+ 9 - 1
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;
+		}
 	}
 
 	/**