The following works:
$user_list = new user_list(); $all_users_list = $user_list->getAllUsers();
The following doesn't work and I'm unsure as to why it doesn't:
$user_list = new user_list();
The above returns:
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, object given on line 59
Classes for reference:
class dbo extends mysqli { public function __construct(){ require('config_db.inc.php'); parent::__construct($db_host, $db_user, $db_pass, $db_name); if (mysqli_connect_error()) { die("Connect Error: (".mysqli_connect_errno().") - ".mysqli_connect_error()); } } } class user_list extends user { var $table_name = "cms_users"; function __construct($group = "") { if ($group == "") { return $this->getAllUsers(); } else { $this->getUsersFromGroup($group); return $this->result; } } function getAllUsers() { $dbh = new dbo(); $sql = "SELECT * FROM {$this->table_name}"; return $dbh->query($sql); } function getUsersFromGroup($group) { $dbh = new dbo(); $sql = "SELECT * FROM {$this->table_name} WHERE group=$group"; return $dbh->query($sql); } }