CodeIgniter Forums
Pagination problem in CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Pagination problem in CI (/thread-18134.html)



Pagination problem in CI - El Forum - 04-26-2009

[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)


Pagination problem in CI - El Forum - 04-26-2009

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

Try adding this to the config array.


Pagination problem in CI - El Forum - 04-26-2009

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


Pagination problem in CI - El Forum - 04-26-2009

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