So this week my goal is to setup pagination on my recipe site but, before I dive in I was hoping to get some feedback.
I've been researching a few different options, mainly whether I should begin with recipes.php?page=0 or recipes.php?page=1 as the first page, does either option matter significantly?
I have read in a few places then when dealing with potentially hundreds of pages, using OFFSET can cause issue?
Secondly, I'm thinking of using this for the main code snippet:
Quote:
$page_number = mysqli_escape_string($con, $_GET['page']);
$count_per_page = 20;
$next_offset = $page_number * $count_per_page;
$cat =mysqli_query($con, "SELECT * FROM Recipes LIMIT $count_per_page OFFSET $next_offset");
while ($row = mysqli_fetch_array($cat))
$count = $row[0];
|
Is that the simplest way of achieving what I need to happen (main results page, with navigation to X amount of other pages) or will the OFFSET stuff cause issue because the items on the page is low thus generating hundreds of pages?
Also, is that
TOO simple and restrictive as far as the functions go of generating the page navigation?
Finally, when it comes to the navigation itself, is it best (in your experience) to just have numerical pages listed or should I also include a 'PREVIOUS' and 'NEXT' link on the navigation structure?
Thanks in advance for any advice and feedback you can offer
