My model method always gives "No User Found". Why is it that my query never returns any rows?
When $page is 0 and $offset is 5, I expect to see the first 5 rows from the database table
Controller
public function filter($page = 0, $offset = 5, $search = '') { $search = $this->input->post('search'); $row = $this->m_user->getAllFilterUsers($offset, $page, $search); $data['usersTable'] = $row->result(); // more scripting } Model
public function getAllFilterUsers($offset, $count, $search) { if ($search != '') { $this->db->where('user_position', 'client'); $this->db->where('user_status', $search); } $this->db->where('user_position','client'); $this->db->where('user_status','active'); $this->db->order_by('user_id', 'desc'); $UsersQuery = $this->db->get('tb_user', $offset, $count); if($UsersQuery->num_rows>0){ return $UsersQuery; } else { $this->session->set_flashdata('message','No User Found'); redirect('cuser/filter','refresh'); } }