|
might be an easier way, but you could do something like
previous, SELECT * FROM product_table WHERE product_id < var_previousID ORDER BY product_id DESC LIMIT 1
next, SELECT * FROM product_table WHERE product_id > var_previousID ORDER BY product_id ASC LIMIT 1
that should just select one record, either the next greatest product id, or next smallest
|