The script pulls out the last 10 posts from the database (home). At the bottom of the page there should be a page navigation (<- next page and previous page ->). How is it better to implement in php? To transfer through the gett the date range of the old posts and pull them out of the base?

    2 answers 2

    I would do this: when clicking on "<- next page and previous page ->", I simply redirect to the same page, but with a GET parameter, for example:

    header("Location: http://example.com/search?page=N"); 

    Where N is the ordinal number of a page with 10 posts. Further, I would execute a SQL query in the form of this:

      SELECT * FROM posts ORDER BY date_add DESC LIMIT N*10, 10 

    Well, then there is the matter of technology.

    In fact, this is the exact same page navigation . Having understood its mechanism, you can easily implement (it sounds simpler than implementation, but closer to the people ;)) and your idea. And what it will be based on is up to you: either a regular GET request, or using ajax, etc.

    • No offense. I did not know how this thing is called. ; ) - yoki