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

[eluser]spider pig[/eluser]
Wouldn't the first page start at zero?

Once you get the hang of it, the CI Pagination feature is great. Before I had to calculate the start value:

Code:
$query = "select * from table limit ".(($page-1) * $items).",".$items;

Now the code is cleaner:

Code:
$start = $this->uri->segment(5, 0);
$query = "select * from table limit ".$start.",".$items;

You can always calculate the page:

Code:
$page = ceil($start/$items);


Messages In This Thread
CI Pagination - by El Forum - 09-07-2008, 07:54 PM
CI Pagination - by El Forum - 09-07-2008, 10:26 PM
CI Pagination - by El Forum - 09-08-2008, 02:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB