• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pagination current page not changing

#1
Hi Coders,

i just wanna know on how to set-up pagination while enable_query_strings is enable or set to true. i tried in many ways but im failed.  and i just get the link work but the data cannot retrieved for the next page.

here my current code.
PHP Code:
$config["base_url"] = base_url() . "index.php?dir-move=public&switch=branch_reports&task=branch_report_por";
$config["total_rows"] = $this->model_ho_por->page_count_for_br_por_sr_report();
$config["per_page"] = 3;
$config["uri_segment"] = 3;
$config['num_links'] = 2;
$config['page_query_string'] = true;
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] = '</ul>';
config['prev_link'] = '<';
$config['prev_tag_open'] = '<li>';
$config['prev_tag_close'] = '';
$config['first_link'] = 'First';
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '';
$config['next_link'] = '>';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '';
$config['cur_tag_open'] = '<li class="active"><a href="">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '';
$config['last_link'] = 'Last';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '';
$this->pagination->initialize($config);
$page = ($this->uri->segment(3))? $this->uri->segment(3) : 0;
$data["load_rs_report"] = $this->model_ho_por->branch_ho_sr($config["per_page"], $page);
$data["pages"] = $this->pagination->create_links(); 
Reply

#2
i got link below but the data are not change,

?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=1
?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=2
?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=3
?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=4
?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=5
Reply

#3
(09-22-2016, 04:12 AM)jaysondotp Wrote: i got link below but the data are not change,

?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=1
?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=2
?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=3
?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=4
?dir-move=public&switch=branch_reports&task=branch_report_por&per_page=5

Try using GET instead of URI Segment to get the page number.

$this->input->get('per_page', TRUE); // XSS Clean
$this->input->get('per_page', FALSE); // No XSS Filter

https://www.codeigniter.com/user_guide/l...input.html
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.