sql >> Databasteknik >  >> RDS >> Mysql

Hur skapar man paginering i Codeiginter?

Styrenhet:

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);
    }

Modell

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();

 }


  1. Hur man gör dynamiska postgres-förberedda uttalanden i PHP

  2. Skillnaden mellan SYSDATE() och NOW() i MariaDB

  3. Importera en CSV-fil till en SQLite-tabell

  4. REGEXP_COUNT() Funktion i Oracle