my issue is that I have a database with values like the ones below:\
|Entries|Name|
|12 |Bob |
|14 |Bob |
|15 |Bob |
|27 |Kevin|
|19 |Kevin|
|29 |Dale|
|18 |Dale|
|23 |Dale|
|13 |Dale|
I would like to have pagination where each page lists the entries for each name. So there would be a page for bob, then the next page would have kevins, and then the next would have dales. I know I must use limits to achieve this, but my question is how I would limit each page when the names(Bob,Kevin,Dale) all have different amount of entries.
Below is some php I used in the page where I just wanted 12 entries per page, This may or may not help, I just wanted to add it in here just in case.
$limit = 12;
$pages = ceil($count/$limit);
//check to see if pages is smaller than
$page = min($pages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array(
'options' => array(
'default' => 1,
'min_range' => 1,
),
)));
$offset = ($page-1) * $limit;
$query = "SELECT `actual_quote`,`poster`,`formtype`,`id` FROM `data` WHERE `formtype` = 'Inspirational' LIMIT 13 OFFSET :offset";
$stmt = $db->prepare($query);
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
$stmt->execute();