[eluser]Marlon Souza[/eluser]
Dear,
I have a problem in the IC pagination, when set the number, ou press a next page does not advance a number, but the data are ok, staying for page 1, how do solve?
Strange, because the admin of site I used the same code and the page runs nomal
Follow my code controllers and views
Code:
class Function extends Controller {
function Function(){
parent::Controller();
$this->load->library('pagination');
$this->load->model('Produtos_model');
}
function index($pagina=""){
$dados['envio']="";
$limite="15";
if($pagina==""){
$pagina='0';
}
else{
$pagina=$pagina;
}
$indice=$pagina;
$config['base_url'] = 'http://DOMAIN.com.br/PAGE/index/';
$query = $this->db->query("SELECT * FROM product WHERE id_pcat='1'");
$config['total_rows']=$query->num_rows();
$por_pagina=$config['per_page'] = "15";
$this->pagination->initialize($config);
if (isset($page) && is_int($page)){
$offset = $page * $config['per_page'];
}
else{
$offset = 0;
}
$dados['paginacao']= $this->pagination->create_links();
$dados['produtos'] = $this->Produtos_model->categoriasSelecionar('1',$indice,$limite);
$this->load->view('page',$dados);
}
}
now is a model
Code:
public function categoriasSelecionar($id,$limit,$offset) {
$query = $this->db->query("SELECT * FROM product WHERE id_pcat='".$id."' LIMIT ".$limit.",".$offset."");
return $query->result();
}
Await,
Thx and sorry to my english by translate.google