GREETINGS!
im having a problem with my pagination…
i have a table displayed in my under-development website in this format
Company Name Acronym Date of Reg Status
J-CLyps Company JC 2008-10-27 pending edit delete
Test Company TC 2008-10-28 pending edit delete
ABC Company ABCC 2008-10-28 pending edit delete
Sam’s Pooch Co SPP 2008-10-28 pending edit delete
Sam’s Pooch Co SPP 2008-10-28 pending edit delete
1 2 >
but what happens is that when i click either “2” or “>”,
it proceeds to the next page but observe that the pagination links didn’t change
Company Name Acronym Date of Reg Status
Kill Joy KJ 2008-10-29 pending edit delete
1 2 >
it appears like the displayed item is in the first page which was supposed to be in page 2, but when i click on the “back” button in the browser, it displays the previous state.
how can i correct this problem? :(
here is my code for my controller:
class Supplier extends Controller{
function Supplier(){
parent::Controller();
}
function index($orderby, $segment){
$data['title'] = "Suppliers ||";
$data['main'] = 'supplier/view';
$this->load->library('pagination');
$config['base_url'] = base_url().'index.php/supplier/index/'.$orderby;
$config['total_rows'] = $this->db->count_all('suppliers');
$config['per_page'] = '5';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
//load the model and get results
$data['results'] = $this->supp_model->getSupp($config['per_page'],$this->uri->segment(4), $orderby);
// load the view
$this->load->vars($data);
$this->load->view('template');
}
...
here goes my view code:
<table>
<tr>
<td><?php echo anchor('supplier/index/companyname/0/', 'Company Name', array('class'=>'us'))?></td>
<td><?php echo anchor('supplier/index/acronym/0/', 'Acronym', array('class'=>'us'))?></td>
<td><?php echo anchor('supplier/index/registerdate/0/', 'Date of Registration', array('class'=>'us'))?></td>
<td><?php echo anchor('supplier/index/status/0/', 'Status', array('class'=>'us'))?></td>
<td> </td>
<td> </td>
</tr>
<?php foreach($results as $row):?>
<tr>
<td><?php echo $row->companyname?></td>
<td><?php echo $row->acronym?></td>
<td><?php echo $row->registerdate?></td>
<td><?php echo $row->status?></td>
<td><?php echo anchor('supplier/edit', 'edit', array('class'=>'us'))?></td>
<td><?php echo anchor('supplier/delete', 'delete', array('class'=>'us'))?></td>
</tr>
<?php endforeach;?>
</table>
<?php echo $this->pagination->create_links(); ?>
i need any kind of help :D
thanks!!!
by the way, this would be my first month as a “CodeIgniter-er” and a web developer… just so you would know.