Använd paginering detta är det bästa sättet att använda det
skapa dessa för att fungera i modell
Modell
public function get_count($table){
return $this->db->count_all_results($table);
}
public function get_all_userdata($table, $where, $limit, $start){
$query = $this->db->get_where($table, $where, $limit, $start);
$data = $query->result_array();
return $data;
}
Controller
$where = array('status' => 0);
//pagination
$config['base_url'] = base_url('nonactiveusers');
$config['total_rows'] = $this->User_model->get_count();
$config['per_page'] = 5;
$config["num_links"] = 3;
$config['uri_segment'] = 2;
$config['full_tag_open'] = "<ul class='pagination'>";
$config['full_tag_close'] ="</ul>";
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
$config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
$config['next_tag_open'] = "<li>";
$config['next_tag_close'] = "</li>";
$config['prev_tag_open'] = "<li>";
$config['prev_tag_close'] = "</li>";
$config['first_tag_open'] = "<li>";
$config['first_tag_close'] = "</li>";
$config['last_tag_open'] = "<li>";
$config['last_tag_close'] = "</li>";
$config['first_link'] = "<<";
$config['last_link'] = ">>";
$this->pagination->initialize($config);
$page = $this->uri->segment(3); // your uri segment here
$data['links'] = $this->pagination->create_links();
$result = $this->User_model->get_all_userdata("users", $where, $config['per_page'], $page);
$data['users'] = $result;
$this->load->view('view', $data);