I am working on some PHP / mysql 5 web project involving a database table that uses not indexed GUID strings as its identifier for rows. So the rows of this product table look like this:
GUID Name
936DA01F-9ABD-4d9d-80C7-02AF85C822A8 Product 1
07c5bcdc-b3a6-482f-8556-bb04fae06538 Product 2
b7b39700-d0e2-11de-8a39-0800200c9a66 Product 3
The new requirement is, when I am on the details page of Product 2
, this page should contain a previous link (pointing to Product 1
) and a back link pointing to Product 3
.
Finding Product 2
is easy:
SELECT * FROM products WHERE GUID = "07c5bcdc-b3a6-482f-8556-bb04fae06538"
But how would I find the GUIDs of the previous and next products?
Remember: The product table has no auto-increment column and I cant add one easily as I am not in control over the database ...
EDIT:
The records are ordered by a timestamp column.