소스 검색

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

markjcrane 9 년 전
부모
커밋
7c4e437f47
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  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;
+		}
 	}
 
 	/**