I somehow need a way for the following:
User is located at some blog page Now I want to give him the ability to move either:
To the next more popular page OR to the next less popular page. Means, something like this:
[PAGE 5] | [PAGE 3 (User is here)] | [PAGE 2]
(Where Page 1 = most popular, Page 3 = least popular). My MySQL Table looks like this:
[ID] [VIEWS]
[1] [1000]
[2] [2560]
[3] [3200]
[4] [200]
[5] [4000]
My problem is the specific query. The only given variable is the ID: 2 in this case. Maybe you can help me out. Just tell me if you need further informations.
(I only need the two neighbours. Page 4 etc. would not be needed.)
Edit: @Trevor No, sorry I cant. I changed the example so its more clearly.
NOTE: As worked out in the various comments, @mellamokb’s answer is better than mine. I would delete this answer but am unable to since it was accepted.