From 7176def0a5010b9597c832486a452619a3b96fa1 Mon Sep 17 00:00:00 2001 From: cortylal <alexcortyl@gmail.com> Date: Thu, 19 Jun 2014 01:50:57 +0200 Subject: [PATCH] stats --- class/stats.php | 2 +- view/stats.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/class/stats.php b/class/stats.php index aa3d98c..8110111 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 fee5a3e..df2d3da 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 -- GitLab