Suppose our database has items with id
1 2 4 18 25 67 (may be between records were deleted for some reasons)
now when item 18 is being displayed....there should be next item button which should point to 25....then 25 to 67 and so on....in 67 the next item button should not be there (means may be dimmed)
so what is best and efficient way of doing it...
best i can think of for now,may be
select min(id) from table where id>current_id (for next)
select max(id) from table where id<current(for previous)
how resource friendly is it?
and any other better way than this...