I need help debugging my code. Im new in php and im currently using frameworkignign framework. Im trying to display the contents of my database table on my page
/controllers/users.php
$<?php
class Users extends CI_Controller{
function __Users(){
parent::__Controller();
$this->load->model('Users');
}
function index(){
$data['users']=$this->Users->getUsersWhere('userid <',5);
$data['numusers']=$this->Users->getNumUsers();
$data['title']='Displaying user data';
$data['header']='User List';
$this->load->view('users_view',$data);
}
}
?>
/models/users.php
$<?php
class Users extends CI_Model{
function __Users(){
parent::__CI_Model();
$this->load->database();
}
function getAllUsers(){
$query=$this->db->get('admin_user');
if($query->num_rows()>0){
return $query->result_array();
}
}
function getUsersWhere($field,$param){
$this->db->where($field,$param);
$query=$this->db->get('admin_user');
return $query->result_array();
}
function getNumUsers(){
return $this->db->count_all('admin_user');
}
}
?>
im with this error
Fatal error: call getUsersWhere () member function on a non-object in C: \ XAMPP \ HTDOCS \ printone \ Application \ Controllers \ users.php on line 16
What mistake?
source
share