Skip to content
Snippets Groups Projects
Commit 98eb8c88 authored by goujonpa's avatar goujonpa
Browse files

Merge branch 'master' of gitlab.utc.fr:nf17-camp-p14/clivi

parents e3f98e24 7176def0
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......@@ -56,6 +56,7 @@ class Stats
WHERE a.client = c.id
AND f.animal = a.id
GROUP BY c.nom, c.prenom, c.id
ORDER BY prix DESC
LIMIT 3" ); // on prépare notre requête
$requete_prepare->execute();
......@@ -76,7 +77,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;
}
......
......@@ -3,7 +3,14 @@
<div class="page-header">
<h1><?php echo $list->getTitle(); ?></h1>
</div>
<?php try { ?>
<?php
$ok = true;
try {
$test=$list->getLabels();
} catch (Exception $e) { print($e->getMessage());
$ok = false;
} ?>
<?php if($ok) { ?>
<table class="table">
<thead>
<?php foreach($list->getLabels() as $field): ?>
......@@ -22,7 +29,5 @@
<?php endforeach; ?>
</tbody>
</table>
<?php } catch(Exception $e) {
echo $e->getMessage();
} ?>
</div>
\ No newline at end of file
<?php } ?>
</div>
......@@ -36,4 +36,45 @@
<?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_total"]; ?> </td>
</tr>
<?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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment