Browse Source

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

markjcrane 9 năm trước cách đây
mục cha
commit
7c4e437f47
1 tập tin đã thay đổi với 9 bổ sung1 xóa
  1. 9 1
      resources/classes/groups.php

+ 9 - 1
resources/classes/groups.php

@@ -34,11 +34,19 @@
  */
  */
 class groups {
 class groups {
 
 
+	public $db;
+
 	/**
 	/**
 	 * Called when the object is created
 	 * Called when the object is created
 	 */
 	 */
 	public function __construct() {
 	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;
+		}
 	}
 	}
 
 
 	/**
 	/**