Previous/Next Rows in mySQL

wxdqz

New Member
Hello all. Is there a way to retrieve the previous and next row if your a given the middle row? I have script, and i need to be able to grab data from the row after the row specified [$rowNum] and from the row right before the specified row [$rowNum].

If someone could help me out, i'd appreciate it. I conisdered querying for each row by its num [i have an auto_increment set so it stores row numbers] but when a row is deleted, the numbers arent rebuilt, so if i specify $rowNum as say 5, the previous row may not be 4, depending on whether or not it was deleted.

Thanks,
Bryan
 
Back
Top