I'm creating a product rating system, to view a specific product, the following URL is used: www.example.com/category?product_id=1
. The navigation on each page is simply the current product_id
+ 1 / -1, so if you were to view the example URL I just gave, back would go to product_id=0
and next would go to product_id=2
. This works fine, until I delete a product from the database, and that product_id
no longer exists, the URL it was at just displays a blank page.
What would be the correct way to turn this navigation into a dynamic one, so that it goes to the next product_id
rather than a set product_id
?