PHP: switch through user details based on userid in url with previous and next buttons
On my first page i have a list of users, say 7. when one is clicked on you get to see his details.
Now, the userid for which the information is needed is sent via the url: ?userid=1.
(but only of 1 user)
What i'm trying to do is, when on the detail page of a user, create a previous and a next button to switch between the detail pages without having to go back to the overview page.
how do i pass the correct userids to the links of the previous and next buttons?
should i grab the userid's on every page from the db and assign the one before the current to the previous button and the following id to the next button? (if so, how do i get the previous and following userids from a string?)