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

[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 Wink) 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


Messages In This Thread
MySQL problem? - by El Forum - 08-14-2012, 08:40 AM
MySQL problem? - by El Forum - 08-14-2012, 11:47 AM
MySQL problem? - by El Forum - 08-14-2012, 01:14 PM
MySQL problem? - by El Forum - 08-14-2012, 01:51 PM
MySQL problem? - by El Forum - 08-14-2012, 04:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB