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

[eluser]Federico BaƱa[/eluser]
your "getstudents" method should have a parameter to indicate the page you're loading, like this:
Code:
$page = $this->uri->segment(3); // get the page from the query string (url)
$this->page_model->getstudents($page); // pass the page over to the model

and your query could be like:

Code:
public function getstudents($page)
{
    $this->db->limit($page, 3); // narrow your query to only the rows on the page
    $query = $this->db->get('students'); // run query
    return $query->result(); // return results
}


Messages In This Thread
Pagination - by El Forum - 12-27-2010, 05:05 AM
Pagination - by El Forum - 12-27-2010, 05:37 AM
Pagination - by El Forum - 12-27-2010, 07:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB