Skip to content
Advertisement

pagination show an extra page

I am currently doing a paging system and I have an error that the “NEXT” button continues to work despite having reached the last page, when clicking this it takes me to an extra page without content.

The “next” button should disappear on page 2 but it is continuous and sends me to page 3 where there is no content.

CODE

Advertisement

Answer

Since you only want to show the next link if the total pages are higher than the current page number, you can change the condition to:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement