Pagination avec class pdo / mysql
Bonjour,
j'ai afficher la liste de ma table avec ma class sur mon theme actuel j'ai une fausse pagination.
Je souhaiterai remplacer par une pagination pdo avec une classe.
j'ai trouvé ceci :
voici ce que j'ai fait j'ai bien une pagination 1 à 3.
Mais l'annuaire reste complet sur chaque page plutot que de se diviser en 3 pages.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| <div class="row span-none">
foreach($managerServicePublic->getListGroupByPivot() as $lstAll)
{
<div class="col-md-4">
<a href="listing-details.html">
<div class="list-mig-like-com com-mar-bot-30">
<div class="list-mig-lc-con">
<h5>echo'$lstAll->getPivot()'</h5>
<h6>echo'$lstAll->getTypeService()'</h6>
<p>echo'$lstAll->getCommune()'</p>
</div>
</div>
</a>
</div>
}
$nbElements = $managerServicePublic->countGroupByPivot();
$PaginationFinal = new Pagination();
$PaginationFinal->setCurrentPage($_GET['page']);
$PaginationFinal->setInnerLinks(3);
$PaginationFinal->setNbElementsInPage(12);
$PaginationFinal->setNbMaxElements($nbElements);
$paginationFinal = $PaginationFinal->renderBootstrapPagination();
echo'$paginationFinal'; |
mes fonctions des mes classes :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
public function countGroupByPivot()
{
return $this->db->query('SELECT COUNT(*) FROM service group by pivot')->fetchColumn();
}
public function getListGroupByPivotLocal($debut = -1, $limite = -1)
{
$listeService = array();
$sql = 'SELECT id_service,id_data,code_insee,date_maj,pivot,..... FROM service group by pivot';
if ($debut != -1 || $limite != -1)
$sql .= ' LIMIT ' . (int) $debut . ', ' . (int) $limite;
$requete = $this->db->query($sql);
while ($Service = $requete->fetch(PDO::FETCH_ASSOC))
$listeService[] = new Service ($Service);
$requete->closeCursor();
return $listeService;
} |
j'ai du effectuer un group by car dans ma base de donnée j'ai des infos d'annaire avec des pivot identique tels que mairie,etc,..
merci pour votre aide.