Welcome Guest, Not a member yet? Register   Sign In
Pagination Probelm
#1

[eluser]Unknown[/eluser]
Hi, I am getting some problem with the pagination,
I am trying to display 5 items but all the items in the database is showing up. Below is the code I am using.

$config['base_url'] = "http://localhost/zb/index.php/category/post/$cat";
$config['total_rows'] = $this->db->get_where('posts', array('category' => $cat))->num_rows();
$config['per_page'] = 5;
$config['num_links'] = 10;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';

$this->pagination->initialize($config);
$query=$this->db->get_where('posts', array('category'=>$cat));

if($query->num_rows() > 0)
{
foreach ($query->result() as $rows)
{
$data[] = $rows;
}
return $data;
}


Messages In This Thread
Pagination Probelm - by El Forum - 04-28-2011, 07:09 PM
Pagination Probelm - by El Forum - 04-29-2011, 05:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB