LIMIT $start, 10... how to pass last value queried into next page with GET??


Posted on 16th Feb 2014 07:03 pm by admin

Ok I know how to display the first or last 10 results of a query...

$result = mysql_query("SELECT * FROM messages ORDER BY timemsg DESC LIMIT 10");

Did you know?Explore Trending and Topic pages for more stories like this.
In a perfect world all the rows ID's would be in perfect order (i.e.- 10,9,8,7,6,5,4,3,2,1), so to display messages 30 to 40 I would just do LIMIT 30,10
but because of certain unforseen situations the actual results will end up being more like-
457
455
454
453
449
448
447
419
418
410

So I can display the last 10 results in descending order but then to show the "previous 10" results (using the above numbers for an example), I'm thinking I need to somehow
capture the last result in this query (410) so when you hit "previous 10" link it passes it through GET to the next page and the next page will use something like LIMIT $start,10
to display the 10 results with before "410" and so on. Any idea how to do this, I don't think it should be that hard, just can't figure it out. Sorry, if this is in wrong thread,
feel free to move to MYSQL board if it belongs there.. Thanks for any help!
No comments posted yet

Your Answer:

Login to answer
72 Like 13 Dislike
Previous forums Next forums
Other forums

Update not working ... please help
Hi,

I am trying to update a row using an edit form by passing id of the row .. but it is not

Multiple websites question.
Hi, does php have any functionality that enables a programmer to extract information from a website

Using Curl_multi for processing multiple URLs
Hi,

I am at a loss as to how to implement this. I would like to be able to automatically assi

$GPRMC and NMEA how to extract from report
Hi There,

Im a little bi lost and not sure where to start with this one, ive got a small gps

Posting to another Site?
I have software that people install.
When they install it, is there a way to make it post their d

Force download script not handling files with spaces properly
I have a regular old php force download script, uses this code:

Code: header("Cache-Cont

question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.

I hav

Looking for help reading a .txt or .ini file and outputting the info.
I have a file called Info.ini and It has the following info:
Code: [General]
Online=0
I wou

Error in Configure System Landscape Directory phase
Hi

We are getting the error in Configure SLD phase ( 41 of 44 phase).

Please f

Is STL important?
I'm just starting programming and I've made it until the Standart Template Library. But the chapter

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash