diff --git a/class/stats.php b/class/stats.php index 70b095c29ecff3166004ab383cf2429481373af6..0e72fd34a9a45caa04ce239e970adad64f68df38 100644 --- a/class/stats.php +++ b/class/stats.php @@ -76,7 +76,7 @@ class Stats LIMIT 3" ); // 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 bc4801f5b2ce7308929b97030151d3d8bdb4288b..6669ff5a1b7a9d2f84ad2b674ba434bf25056e62 100644 --- a/view/stats.php +++ b/view/stats.php @@ -36,4 +36,24 @@ <?php endforeach; ?> </tbody> </table> + + <br/> + <hr/> + <h4>Top 3 des plus grosses factures</h4> + <table class="table"> + <thead> + <th>Nom </th> + <th>Prenom </th> + <th>Montant de la facture </th> + </thead> + <tbody> + <?php foreach ($stats->top3Facture() as $ligne): ?> + <tr> + <td><?php echo $ligne["nom"]; ?> </td> + <td><?php echo $ligne["prenom"]; ?> </td> + <td><?php echo $ligne["prix"]; ?> </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> </div> \ No newline at end of file