[eluser]husni[/eluser]
[quote author="maria clara" date="1264682391"]your uri should be look like this:
Code:
http://localhost/helpdesk2/index.php/paging/display/5
not this:
Code:
http://localhost/helpdesk2/index.php/paging/display/&per_page=5
can you post your updated controller??[/quote]
that's why i said something wrong with my uri..
this is my controller..
Code:
<?php
class Paging extends Controller{
function Paging(){
// load controller parent
parent::Controller();
// load 'Users' model
$this->load->model('Helpdesk_model');
}
function display($row=0){
// load pagination library
$this->load->library('pagination');
// set pagination parameters
$config['base_url']='http://localhost/helpdesk2/index.php/paging/display/';
$config['total_rows']=$this->Helpdesk_model->getNumReport();
$config['per_page']='5';
//$config['uri_segment'] = '3';
$this->pagination->initialize($config);
// to multiply your offset by your $config[‘per_page’]
//That should get rid of the mysql error if no page is specified too
if (isset($page) && is_numeric($page))
{
$offset = $page; //Because if the page is 1 then the offset should be 0
}
else
{
$offset = 0;
}
$data['query'] = $this->Helpdesk_model->getAllReport(5,$offset);
// store data for being displayed on view file
$data['reports']=$this->Helpdesk_model->getReport($row);
$data['title']='Displaying Report data';
$data['header']='Report List';
$data['links']=$this->pagination->create_links();
// load 'testview' view
$this->load->view('report_view',$data);
}
}
?>