diff --git a/class/stats.php b/class/stats.php index aa3d98cbaf425446dc501b3c6d2a55e7169c07e3..811011178708ef5d17fa002bfc121f8c421718e8 100644 --- a/class/stats.php +++ b/class/stats.php @@ -42,7 +42,7 @@ class Stats GROUP BY c.nom, c.prenom, c.id" ); // on prépare notre requête $requete_prepare->execute(); - $ligne = $requete_prepare->fetch(PDO::FETCH_ASSOC); + $ligne = $requete_prepare->fetchAll(PDO::FETCH_ASSOC); return $ligne; } diff --git a/view/stats.php b/view/stats.php index fee5a3ee994f196b5096b9b2196e97c425d4fc25..df2d3da84d25953d97a9db5ea1a16159cb1bbf45 100644 --- a/view/stats.php +++ b/view/stats.php @@ -56,4 +56,25 @@ <?php endforeach; ?> </tbody> </table> + + <br/> + <hr/> + <h4>Nombre d'animaux par client</h4> + <table class="table"> + <thead> + <th>Nom </th> + <th>Prenom </th> + <th>Nombre d'animaux </th> + </thead> + <tbody> + <?php foreach ($stats->nbAnimalClient() as $ligne): ?> + <tr> + <td><?php echo $ligne["nom"]; ?> </td> + <td><?php echo $ligne["prenom"]; ?> </td> + <td><?php echo $ligne["count"]; ?> </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + </div> \ No newline at end of file