
Originally Posted by
misson
I assume "nitem" and "nitms" are misspellings of "nitems",
Ups, sorry. I was writing this at the bus station, so I was a little bit in a hurry. Yes, but it's nitem. ;)
and you're trying to get a specific range of rows ā la the head/tail strategy. As it turns out, neither subselects nor joins are needed. MySQL supports an extended LIMIT clause, where you can specify an offset before the row count:
Code:
SELECT nitems FROM news
ORDER BY nitems ASC
LIMIT :start, :length
When
asking about code, always include short, illustrative examples. It's part of being
precise and informative.
Hmm,
Code:
SELECT nitem FROM news
ORDER BY nitem ASC
LIMIT 10, 3
Returns an empty result. :happysad:
Here is what I currently have:
Code:
SELECT nitem
FROM news
WHERE cat = 'f'
AND nitem >10
ORDER BY nitem ASC
LIMIT 3
The output for this is 11, 12, 13 (but in practice could also be 12, 42, 134). Now I need to get the 13, so currently I go through the list in PHP until I reach the last element and save this as the variable that I use for the link to the previous page. :dunno:
Edit: Ahh, I think I finally understood LIMIT x, y. If LIMIT get 2 values, the first one is the offset (not really the start).
Since I don't really need to have a full list of all the pages (first, previous, next and last are enough), this will do nicely and I already have it up and running. 
Thank you!
P.S.: But sadly it seems x10 is having some difficulties right now. Oh well, I hope it'll work again shortly. :cool: