When a search is carried out in Google it shows something similar to this near the top of the page:
Results 1 - 10 of 50
I am having trouble working out how to do this (I have already implemented pagination).
From the example above (the search is limited to 10 results per page), 1 is simple to achieve, as is 50 (the total number of results), but I can't seem to figure out how to get the 10.
It's late and it's probably very simple to solve, so I am grateful to anyone who can help. Just the logic will be fine, but if it helps to explain your answer in php then it will be appreciated.
Cheers
[SOLVED] Results 1 - 10 of 50
Moderator: General Moderators
If you implemented pagination perhaps there are variables in your code like
so 10 is $start_result + $results_per_page - 1
Code: Select all
$results_per_page; // constant or adjustable by user
$start_result; // from request
$total_results; // from query