Pagination |
[eluser]Unknown[/eluser]
Hi guys, I read many topics but I don't see my solution. I have integrated the code in my model: class Data_model extends CI_Model { function getAll() { $config['base_url'] = 'http://www.mysite.org/site/index/'; $this->load->library('pagination'); $config['total_rows'] = $this->db->get('data')->num_rows(); $config['per_page'] = '5'; $this->pagination->initialize($config); $q = $this->db->query("SELECT * FROM data order by submission_time desc"); if($q->num_rows() > 0){ foreach($q->result() as $row) { $data[] = $row; } return $data; } } } Now I see the pagination div < 1 2 > but the page 1 and 2 are identical. the pagination links work: http://www.mysite.org/site/index/1 http://www.mysite.org/site/index/2 http://www.mysite.org/site/index/3 but the articles in homepage are not limited and the pages are identical. Can you help me please?
[eluser]cideveloper[/eluser]
That because you are not doing a limit, offset in your sql statement. e.g. Code: $limit= 10;
|
Welcome Guest, Not a member yet? Register Sign In |