Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey guys,

I have a pagination and I noticed that all the links shows the same list of data, it shows the same first five because I set the limit to 5. Anyone knows this?

Controller:
PHP
$this->load->library('table');
        $config['base_url']='http://localhost/AnimeInventory/index.php/maincontroller/records';
        $config['total_rows'] = $this->db->get('detail')->num_rows();
        $config['per_page'] = 5;
        $config['num_links'] = 2;
        $config['uri_segment'] = 3;
        $data['getRecords'] = $this->inventoryModel->selectData($config['per_page'],$this->uri->segment(3));
        $this->pagination->initialize($config);
        $this->load->view('template/header');
        $this->load->view('printdog',$data);
        $this->load->view('template/footer');


Model:
PHP
public function selectData(){
       $sql = "SELECT detail.id, detail.Title, genre.GenreName, detail.EntryDate From detail
               INNER JOIN genre on detail.GenreID = genre.GenreID LIMIT 5 OFFSET 5";
                  $daf = $this->db->query($sql);
                  return $daf->result_array();
    }


Thanks,
Posted
Updated 15-May-14 21:21pm
v2

1 solution

I got it now, I used limit in the model and set the offset based on the $this->uri->segment(3);'s value.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900