Select next from in mysql

id date panaid
5 1332533806 14
543 1332533943 16
322 1332533825 29

anyone have simple idea to select by date next row?
if true then give next id :slight_smile:

Would you mind explaining a bit more? It’s not clear to me what you want.

emm get next or previous id by date
previous id(with lower date)
or
next(with newer date)

lower than what date?
newer than what date?

Remember that we don’t have the slightest idea what you are working on. So a minimum of explanation is required.

emmmm find any previous or next results by date if found

if $prevdate then give true
if $nextdate then give true

emm now u understand?:slight_smile:

No. You’re not explaining anything, to be honest.

ehhhhh :smiley:
i have gallery but i don’t have code for +1 id and -1 id

Previous- IMAGE +Next
(Previous button give id to go on older image, Next button give id to go on newer image)

now ? :slight_smile:

not quite :slight_smile:

previous and next make sense only in the context of (1) you’re looking at a specific image, and (2) you have a rule which determines sequence

you’ve already covered (2) in your first post – by date

now all you have to do is explain (1) – how you decide which image

get id for next or previous row

next or previous, or next and previous?

and “next” or “previous” relative to which id?

That’s what I asked before too.

What is your starting point? When you say next and previous, lower and newer, you have to say what your starting point is.

A date given by the user? The current date?

yes current date given by user.

why do you need the user to tell you the current date?

there’s a function for that