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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
| <html>
<head>
<style type="text/css">
#arriere_plan {
width:400px;
height:147px;
background:bdfdcc;
margin-left:400px;
margin-top:100px;
}
table
{
border-collapse: collapse;
}
caption
{
font-family:verdana;
font-size:18;
caption-side:top;
}
th
{
border: 2px solid black;
background:c0f4cc;
font-family:verdana;
font-size:15;
}
td
{
border: 2px solid black;
background:c0f4cc;
font-family:verdana;
font-size:15;
}
tr
{
border: 2px solid black;
background:c0f4cc;
font-family:verdana;
font-size:15;
}
</style>
</head>
<body>
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=productions','root','',array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
?>
<thead>
</thead>
<tbody>
<caption>Liste des fruits </caption>
<br/>
<tr>
<th>Fruit</th>
<th>Saison</th>
<th>Prix</th>
</tr>
</tbody>
<?php
$reponse = $bdd->query('SELECT * FROM fruits');
$ortie = '<table border="1" width="400">'.chr(13);
while ($donnees = $reponse->fetch())
{
$ortie.= '<tr>'.chr(15);
$ortie.= ' <td>'.$donnees['nom'].'</td>'.chr(15);
$ortie.= ' <td>'.$donnees['saison'].'</td>'.chr(15);
$ortie.= ' <td>'.$donnees['prix'].'</td>'.chr(15);
$ortie.= '</tr>'.chr(15);
}
$ortie.='</table>';
echo $ortie;
$reponse->closeCursor(); // Termine le traitement de la requête
?>
</div>
</body></html> |
Partager