CodeIgniter Forums

Full Version: Pagination problem in CI
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]rajyakshmik[/eluser]
Hi,
I m facing one problem in pagination.Records are showing corretcly and page numbers are not showing properly.If i click pagenum2 also still page 1 link is activated and records are as per 2page.Can u please help me on this.


This is my controller
function couponsissued($dealid)
{
$this->load->library('pagination');
$config['base_url'] = $this->config->item('base_url').'main/couponsissued/'.$dealid;
$usrdata = array(
'dealid' => $dealid
);
$this->session->set_userdata($usrdata);
$this->db->where('DealID', $dealid );
$this->db->from('code');

$config['total_rows'] = $this->db->count_all_results();


$config['per_page'] = '1';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);

$this->load->model('coupons_model');
$data['results'] = $this->coupons_model->get_coupons($config['per_page'],$this->uri->segment(5));

$this->load->view('couponsissued.html',$data);



}
Before clicking pagination my url is
http://colonizer1/dealfrontier/main/couponsissued/RES0001
After clicking pagination my url is
http://colonizer1/dealfrontier/main/couponsissued/RES0001/1(when i m second page)

El Forum

[eluser]Thorpe Obazee[/eluser]
Code:
$config['uri_segment'] = 4;

Try adding this to the config array.

El Forum

[eluser]rajyakshmik[/eluser]
working fine.thanks

El Forum

[eluser]Thorpe Obazee[/eluser]
no problem. I probably have 3 or more topic answers similar to this :p