[eluser]carllawll[/eluser]
I'm trying to create a custom pagination type function, how ever there is only a button to get the next set of values. Although I've got it working, the first page returns 10 values as it should be on the second page (with 6 remaining entries) it only displays 5, which is some what strange. I'm almost certain my maths and query is right.
Could someone take a look for me?
Code:
$offset = ($page - 1) * $this->config->item('per_page');
However if I set it to this (despite giving me an error on the first page because you cant start from -1
) it displays the remaining 6 entries
Code:
$offset = ($page - 1) * $this->config->item('per_page') -1;
For the sake of cutting down the size of my query I've removed the fields im retrieving
Code:
SELECT MYTABLEFIELDS FROM posts
INNER JOIN account ON posts.user_id = account.id
ORDER BY posts.date_added DESC
LIMIT $offset, $limit