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 44 45 46 47 48 49 50 51 52 53 54 55 56
| <!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" >
<head>
<title>le formulaire cible traitant les donnees </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
table
{
/*border-collapse: collapse;*/
}
td /* Toutes les cellules des tableaux... */
{
border: 1px solid #181818; /* auront une bordure de 1px */
background-color : red;
width : 100 px;
}
</style>
</head>
<body>
<?php
try
{
// connection à mysql
$bdd = new PDO ('mysql:host=localhost;dbname=test','root','');
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
//execution de la requete, on recupere l\'ensemble des donnees
$reponse = $bdd->query('SELECT * FROM produits ');
?>
<table>
<?php
foreach ($reponse as $ligne)
{
?> <tr>
<td> <?php echo $ligne['intitule']; ?></td>
<td><?php echo $ligne['q_stock']; ?></td>
<td><?php echo $ligne['prix']; ?></td>
<td><?php echo $ligne['commentaires']; ?></td>
</tr><br/>
</table>
<?php
}
$reponse ->closecursor();
?>
</body>
</html> |
Partager