1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Test Base de donnée</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php //Connection avec la BDD.
$conn = mysqli_connect('localhost', 'root', '', 'tableau');
// on envoie la requête
$res = $conn->query($req);
$req = "SELECT * FROM utilisateurs";
?>
<table>
<tr>
<th>ID</th>
<th>Nom</th>
<th>Prenom</th>
<th>Adresse</th>
<th>Telephone</th>
</tr>
<?php //On affiche les lignes du tableau une à une à l'aide d'une boucle
while ($data = mysqli_fetch_array($res))
{
?>
<tr>
<td><?php echo $donnees['ID'];?></td>
<td><?php echo $donnees['nom'];?></td>
<td><?php echo $donnees['prenom'];?></td>
<td><?php echo $donnees['adresse'];?></td>
<td><?php echo $donnees['telephone'];?></td>
</tr>
<?php
} //fin de la boucle, le tableau contient toute la BDD
mysql_close(); //deconnection de mysql
?>
</table>
</body>
</html> |