• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pagination question : the data change, not the link.

hi, i have a problem with paging in codeigniter.

here my controller in function index:
$data['flash_message'] = '';
$data['page_title'] = 'List of Patient';
//load class Pagination</pre>  
$config['base_url'] = base_url().'index.php/P/p/index';  
$config['total_rows'] = $this->db->count_all('p_d');  
$config['per_page'] = '15';  
$config['num_links'] = '10';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$dati['number'] = $this->uri->segment(4);
$data['data_list'] =  $this->Patient_model->getData_page($config['per_page'], $this->uri->segment(4));  
$data['paging'] = $this->pagination->create_links();  

here my model :

function getData_page($num,$offset)
        $query = $this->db->get('p_d', $num,$offset);  
        return $query->result();  

here my view :

<h2>&lt;?php echo $page_title;?&gt;</h2>
<p>&lt;?php echo $flash_message;?&gt;</p>

    <table width="500" class="stripe" >
        <th class="IdColumn" >&lt;?php echo 'RM';?&gt;</th>
        <th class="IdColumn" >&lt;?php echo 'NP';?&gt;</th>
    &lt;?php foreach($data_list as $data): ?&gt;
        <td>&lt;?php echo $data->pd_nr;?&gt;</td>
        <td>&lt;?php echo $data->pd_n;?&gt;</td>
        <td><a href="&lt;?php echo site_url(">pd_nr")?&gt;"
    &lt;?php endforeach ?&gt;
&lt;?php echo $this->pagination->create_links(); ?&gt;
        <a href="&lt;?php echo site_url('P/p/add')?&gt;" class="submenu_link_add">Reg</a>
<hr />

here my problem :
i have success to show the data and the links on screen. (it's running well)
When i click to the next page (any page) on the links, the data change to the next page data, but the links not change, it still show an first page...

i don't know where should i check..
fyi, i modif my script from

when i running the script sample from that page, it running well...


when i try another paging sample like this tutorial, this tutorial, and this tutorial

it come a same problem before... the data show, but the links stay...

-sorry for my english-
many people say it's a simple problem, but i can't solve it yet...

Hi put in you config
$config['uri_segment'] = 4;

The pagination function automatically determines which segment of your URI contains the page number. If you need something different you can specify it.

check user guide also

it's running well...

thx umefarooq..

*oh.. malu aku...*

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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