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
| <!DOCTYPE html>
*
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
**<head>
****<meta charset="UTF-8">
****<link rel="stylesheet" type="text/css" href="style.css">
****<title>#</title>
****<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
****<!--[if IE]>
****<meta http-equiv="X-UA-Compatible" content="IE=edge">
****<![endif]-->
*
****<link rel="apple-touch-icon-precomposed" href="#">
****<link rel="icon" href="#" sizes="32x32">
****<!--[if IE]><link rel="shortcut icon" href="#"><![endif]-->
****<!-- et utiliser /favicon.ico pour IE10 -->
****<!-- Windows8 tuile Modern UI (facultatif et invalide HTML W3C) -->
****<meta name="msapplication-TileColor" content="#D83434">
****<meta name="msapplication-TileImage" content="#">
****<!-- /Windows8 -->
</head>
*
<header>
**<h1>XtremPhP - Blog -</h1>***
</header>
*
<body>
**<p>Voici les derniers billets du blog :</p>
*
<?php
*
try
{
****// On se connecte à MySQL
****$bdd = new PDO('mysql:host=localhost;dbname=blog;charset=utf8', 'root', '', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
catch(Exception $e)
{
****// En cas d'erreur, on affiche un message et on arrête tout
********die('Erreur : '.$e->getMessage());
}
*
*
****$req = $bdd->query('SELECT * FROM billets ORDER BY id DESC LIMIT 0,5');
*
****while ($donnees=$req->fetch())
****{
*
********echo $donnees['titre'] . ' ' . $donnees['date_creation'] . '.<br />' . $donnees['contenu']. '<br />' . $donnees['auteur'];*
****}
?>
*
</body>
</html> |
Partager