This repository has been archived on 2022-10-26. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
biblio/clients.php
2019-02-11 10:24:07 +01:00

48 lines
No EOL
1 KiB
PHP

<?php
require_once "includes/bdd.php";
// Récupération des clients
$clients = $bdd->prepare("
SELECT code, nom, prenom, ville, COUNT(biblio_emprunt.livre) AS emprunts
FROM biblio_client LEFT JOIN biblio_emprunt ON biblio_client.code = biblio_emprunt.client
GROUP BY code;
");
$clients->execute();
?>
<!DOCTYPE html>
<html>
<head>
<title>Biblio | Clients</title>
<?php require_once "includes/head.php"; ?>
</head>
<body>
<div id="container">
<ul id="nav">
<!-- Navigation -->
<a href=".">Retour à l'accueil</a>
</ul>
<hr>
<h2>Liste des clients</h2>
<table>
<tr>
<th>Code</th>
<th>Nom</th>
<th>Prénom</th>
<th>Ville</th>
<th>Emprunts</th>
</tr>
<?php
while($client = $clients->fetch(PDO::FETCH_ASSOC)){
echo "<tr>";
foreach($client as $key => $info){
echo "<td>".$info."</td>";
}
echo "<td><a href=\"client.php?code=".$client["code"]."\">Voir/éditer</a></td>";
echo "</tr>";
}
?>
</table>
</div>
</body>
</html>