Mysql
 sql >> Database >  >> RDS >> Mysql

Come creare l'impaginazione in Codeiginter?

Titolare:

public function all_students() 
 {      $this->load->model('loginmodel');
        $config['anchor_class'] = '';
        $config['show_count'] = true;
        $config['base_url'] = site_url('controllername/all_students');
        $config['total_rows'] = sizeof($this->loginmodel->students_list());

        $data['students_data']= $this->loginmodel->students_list();
        $data['dropdown']=      $this->loginmodel->get_degree_names();
        $config['per_page'] = 10;
        $this->jquery_pagination->initialize($config);
        $data['links'] = $this->jquery_pagination->create_links();
        $data['page'] = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
        $data['details'] = $this->loginmodel->students_list($config['per_page'], $data['page']);
        $this->load->view('all_students', $data);
    }

Modello

public function students_list($limit=NULL,$start=NULL)
{


    $this->db->select('*');
    $this->db->from('student'); 

    $this->db->limit($limit,$start);                

    $query= $this->db->get();

    return $query->result();

 }