areid wrote:Is there any easy way to see if there is a next or previous record in a MySQL table without looping through all the records?
No.
areid wrote:If I select a row, can I ask if there is a row before and/or after that row?
No.
Assuming you are talking about MySQL.
Or to be more precise, if you want to do this, you will need to gather information about the rows you have returned.
If you are displaying a row at a time, you do know already if there are more rows in the set of returned rows, or if there was a row previous to the one being displayed.
I suspect what you are asking is "If my query returns a set of XXX number of records, does MySQL sort of number those records 1 - XXX, and keep that information hanging around for later access? and can then I simply say "Show me record 3" or something similar.
No.