Hello all.
Is there an easy way (via MySQL or otherwise) to get the very first record before a given record? I know I could get them all in an ordered array, find the record given, then choose the array just before it, but that seems sort of inefficient.
i.e.
I have a table with an 'id' column that is auto_increment. I have a list ordered by 'id' ascending. What I am wanting to do is to create a "move up" and "move down" link. I was initially thinking just to increment or decrement the ID by one and swap the rows. This obviously wont work once an ID is skipped or deleted from the contiguous range.
Can someone help me figure out a way to do this still using auto_increment my id column?
TIA.