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
|
<?php
try
{
// On se connecte à MySQL
$bdd = new PDO('mysql:host=localhost;dbname=annonces', 'root', '');
}
catch(Exception $e)
{
// En cas d'erreur, on affiche un message et on arrête tout
die('Erreur : '.$e->getMessage());
}
$reponse = $bdd->query('SELECT * FROM annonce ORDER BY datecreation DESC');
echo '<table border="1" cellspacing="0" bordercolordark="white" bordercolorlight="white">';
while ($donnees = $reponse->fetch())
{
echo '
<tr>
<td><b>'.$donnees['ID'].'</b></td>
<td><b>'.$donnees['departement'].'</b></td>
<td><b>'.$donnees['titre'].'</b></td>
</tr>';
}
echo '</table><br>';
$reponse->closeCursor();
?> |