I have an MLS site that you can search and it gives you a list of results. I then store the mysql string in a session.
When you c开发者_如何学JAVAlick on a result you go to the page listed by its property MLS number.
From that page I have a forward and backward button that is supposed to go back and forth through properties.
How do I use that same stored query string to find the next result and previous result depending on what property I am looking at?
Assuming the results are ordered by id, you could modify the stored query like this:
WHERE id > current_id LIMIT 1
to get the next property, where current_id is the id of the currently viewed record, and likewise:
WHERE id < current_id LIMIT 1
to get the previous one.
精彩评论