<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="author" content="Manuele" />
<title> Connexion BdD</title>
<link rel="stylesheet" href="css/tableaux.css" />
</head>
<body>
<h1>Liste de clients </h1>
<?php
/* on etablit la connexion */
require "connexion.php" ;
$mysqli = connexion();
$sql = "SELECT id, nom, email, adresse FROM client ORDER BY nom " ;
$result = $mysqli->query ($sql) ;
if ( ! $result ) { echo "<p> Desolée, requête impossible ! </p>" ; }
else {
echo "<table> <caption> Clients </caption>";
echo "<tr> <th> id </th> <th> Nom </th>
<th> Email </th> <th> Adresse </th> </tr>";
/* on va recuperer ligne a ligne avec une boucle */
while ( $ligne = $result->fetch_object() ) {
echo " <tr> ";
echo "<td>" . $ligne->id . "</td>";
echo "<td>" . $ligne->nom . "</td>";
echo "<td>" . $ligne->email . "</td>";
echo "<td>" . $ligne->adresse . "</td>";
echo "</tr> ";
}
echo "</table>" ;
}
$mysqli->close();
?>
</body>
</html>