Update the constructor and $db connection handling in the groups and switch_settings classes.
This commit is contained in:
parent
c2ecb23413
commit
a6cd585315
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue