We often use the previous one, the next, or the next in the CMS system, which is simple to use.
The tentative data table here is the news field name as ID. The current urlid parameter value is currentid.
If you follow the general idea, the following is the SQL statement used to extract the information from the previous article.
select * from news where id=currentId-1;
The following is the SQL statement used to extract the next information.
select * from news where id=currentId+1;
This is simple, but there is a limitation that all IDs must be connected. If disconnected, an error will occur, for example, if there is no id = 16 between id = 15 and ID = 17, an error occurs when you obtain the next record from id = 15 and ID = 17, therefore, the preceding SQL statement cannot be used.
The following is a good SQL statement used to process the previous and next operations.
Extract the previous SQL statement
select * from news where id<currentId order by id desc limit 0,1;
Or
select * from news where id<currentId order by id desc limit 1;
Extract the next SQL statement
select * from news where id >currrentId order by id asc limit 0,1;
Or
select * from news where id >currrentId order by id asc limit 1;
I will not talk about hyperlink settings here. If you have any questions, please leave a message!