Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <td><?php
  2. try
  3. {
  4. // On se connecte à MySQL
  5. $bdd = new PDO('mysql:host=localhost;dbname=teachu;charset=utf8', 'root', '');
  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. // Si tout va bien, on peut continuer
  14.  
  15. // On récupère tout le contenu de la table jeux_video
  16. $reponse = $bdd->query('SELECT * FROM reservation');
  17.  
  18. // On affiche chaque entrée une à une
  19. while ($donnees = $reponse->fetch())
  20. {
  21. ?>
  22. <p>
  23. <strong>Professeur : </strong><?php echo $donnees['nomProf']; ?>
  24. <strong>Etudiant : </strong><?php echo $donnees['nomEtud']; ?>
  25. <strong>Date du Cour : </strong><?php echo $donnees['date']; ?>
  26. <strong>Lieu du Cour : </strong><?php echo $donnees['lieu']; ?>
  27. </p>
  28. <?php
  29. }
  30.  
  31. $reponse->closeCursor(); // Termine le traitement de la requête
  32.  
  33. ?>
  34. </td>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement