hello im developing a blog right now… but i don’t have idea how to code the next and previous link to view the older post…
here’s what i want to happen
example i have a 10 article that recorded on database…
so in localhost/blog <- index.php the article are limited to show limit is 0,2 ordered by id asc (mysql_query)
so if i want to view the other articles so it should be localhost/blog?page=2 so in mysql_query it should be limit 2,4… and so on.. if page=3 then limit 4,6 so now how the code that in php? 🙂
another example:
https://i.stack.imgur.com/5yuKa.png
i have my own code
$query = ("SELECT * FROM table ORDER BY idDESC LIMIT $page_limit");
What you are trying to build is called “pagination” and has been covered on StackOverflow time and again. Once you know the term to look out for, it’s easy to get started ;). This should be a good starting point for you to learn how to implement pagination.