Advertisement
Guest User

Justin - Aide

a guest
Nov 21st, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <?php
  2. try
  3. {
  4. // On se connecte à MySQL
  5. $bdd = new PDO('mysql:host=localhost;dbname=test', 'your_password', '');
  6. }
  7. catch(Exception $e)
  8. {
  9. // En cas d'erreur, on affiche un message et on arrête tout
  10. die('Erreur : '.$e->getMessage());
  11. }
  12.  
  13.  
  14. // Si tout va bien, on peut continuer
  15.  
  16. // On récupère tout le contenu de la table jeux_video
  17. $reponse = $bdd->query('SELECT * FROM articles');
  18.  
  19. // On affiche chaque entrée une à une
  20. while ($articles = $reponse->fetch())
  21. {
  22. ?>
  23. <p>
  24. <?php echo $articles['Nom']; ?><br>
  25. Posteur du sujet : <?php echo $articles['posteur']; ?><br>
  26. Promo de : <?php echo $articles['promo']; ?> <br>
  27. Date de la création : <?php echo $articles['date']; ?> <br>
  28. Heure de la création : <?php echo $articles['heure']; ?>
  29. </p>
  30. <?php
  31.  
  32. $req = $bdd->prepare('SELECT * FROM dedicace ORDER BY id DESC LIMIT 10');
  33. $req->execute();
  34. ?>
  35. <marquee>
  36. <?php
  37. while($dedi = $req->fetch()) {
  38. ?>
  39. <b>Par</b> <u><?php echo$dedi['posteur']; ?></u> <b>le</b> <u><?php echo$dedi['date']; ?></u> <b>à</b> <u><?php echo$dedi['heure']; ?></u> <b>==></b> <?php echo$dedi['dedicace']; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement