Welcome Guest, Not a member yet? Register   Sign In
Pagination
#1

[eluser]-spy-[/eluser]
im not familiar with pagination, i followed the steps in the userguide, the created links were ok, but i cant limit the number of records for each page, for every page all records were retrieved..instead of 5 records for each page.. i really need your help

Code:
$config['base_url']    = "http://localhost/pupcommonwealth.edu.ph/administration/profile";
$config['total_rows'] = $this->db->count_all('faculty');
$config['per_page'] = '5';
$config['uri_segment'] = 3;
$config['num_links'] = 5;
$this->pagination->initialize($config);
#2

[eluser]Armchair Samurai[/eluser]
You need to make two queries - one to retrieve the total number of rows, and one to retrieve the records for the current page using limit and offset. For example, in your model, you'd have something like this:
Code:
function get_records($limit, $offset)
{
    $data = new stdClass;

    $data->total = $this->db->count_all('table');
    
    $query = $this->db->get('table', $limit, $offset);
    $data->records = $query->result();

    return $data;
}
#3

[eluser]-spy-[/eluser]
tnx a lot..n_n




Theme © iAndrew 2016 - Forum software by © MyBB