From 0b6a4e742869d9361c2432f5c6e858fe9bf96f5e Mon Sep 17 00:00:00 2001
From: cortylal <alexcortyl@gmail.com>
Date: Thu, 19 Jun 2014 01:37:56 +0200
Subject: [PATCH] stats

---
 class/stats.php |  2 +-
 view/stats.php  | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/class/stats.php b/class/stats.php
index 70b095c..0e72fd3 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 bc4801f..6669ff5 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
-- 
GitLab