php - mysql next record with order by -


What I need is the following, I do not know that this is possible, but I hope someone can help me .

I have 2 questions, first there is a query to choose the specified record.

The second query is to determine the next record. I know I can do this with:

  SELECT * to table WHERE id & gt; IID has given limit 1   

The problem is that there is an order through variable (a visitor can change order order)

Table (given by PHP). I also want to know the next record when the sort order is for example, ORDER by date or ORDER by time etc.

Is there a way to do this with MYSQL?

You can do this

  - Leave 0, a load Do (SELECT * as a 1) table WHERE ID & gt; Given_id ID LIMIT 0,1 - by ORDER, leave one, select one load * to the table WHERE id & gt; Order by Id LIMIT 1,1    

Comments