[eluser]Unknown[/eluser]
Hi All...
I have a problem with pagination. The results does not displays in num-per-page assigned, nor either the pagination links works. Here is my code:
Controller
-----------
function view_guestbook() {
$this->db->order_by('date', 'DESC');
$data['query'] = $this->db->get('guestbook', 3);
$rows = $this->db->count_all('guestbook');
$this->load->library('pagination');
$config['base_url'] = base_url().'index.php/secured/view_guestbook/page';
$config['total_rows'] = $rows;
$config['per_page'] = '3';
$config['num_links'] = 5;
$this->pagination->initialize($config);
$data['pagin'] = $this->pagination->create_links();
$this->load->view('secured/view_guestbook', $data);
}
View
-----
<? foreach ($query->result() as $row): ?>
............
............
<? endforeach; ?>
<center><?=$pagin;?></center>
What is wrong with my code guys... and I think I'm not pulling up data from the database with my pagination... But how to do that?