[eluser]yNaxon[/eluser]
Hello,
as I wrote in the title, the last row on page x is the first row on page x+1.
Controller's Function:
Code:
public function category($id,$pagenum=1)
{
$config['base_url'] = site_url()."/games/category/{$id}";
$config['total_rows'] = $this->game->count_games($id);
$config['per_page'] = '3';
$config['uri_segment'] = 4;
$this->pagination->initialize($config);
$this->data['catname'] = $this->game->get_cat_name($id);
$this->data['games'] = $this->game->get_games($id,$config['per_page'],$this->uri->segment(4,1));
$this->data['pagination'] = $this->pagination->create_links();
count_games function:
[code] public function count_games($catid)
{
$this->db->select('gameid');
$query = $this->db->get_where('games_categories',array('catid'=>$catid));
$data = array();
foreach($query->result_array() as $result)
{
$query = $this->db->get_where('games',array('id'=>$result['gameid']));
array_push($data,$query->result_array());
}
return count($data);
}
get_games function:
Code:
public function get_games($category,$pagenum,$perpage)
{
$query = $this->db->get_where('games_categories',array('catid'=>$category),$pagenum,$perpage);
$data = array();
foreach($query->result_array() as $result)
{
$query = $this->db->get_where('games',array('id'=>$result['gameid']));
array_push($data,$query->result_array());
}
print_r($data);
return $data;
}
Thanks for reading and helping

Yonatan.
$this->layout->view('games/category',$this->data);
}
[/code]