Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1.  
  2. <?php
  3. $mysqli = new mysqli("localhost", "root", "", "gsb");
  4.  
  5. /* Vérification de la connexion */
  6. if (mysqli_connect_errno()) {
  7.     printf("Échec de la connexion : %s\n", $mysqli->connect_error);
  8.     exit();
  9. }
  10.  
  11.  
  12. $sql = "SELECT * FROM `fiche`";
  13.  
  14.  
  15. if ($result = $mysqli->query($sql)) {
  16.  
  17.     /* Récupère un tableau associatif */
  18.     while ($row = $result->fetch_assoc()) {
  19.         echo  $row["libelle"].'<br />';
  20.     }
  21.  
  22.     /* Libération des résultats */
  23.     $result->free();
  24. }
  25.  
  26. /* Fermeture de la connexion */
  27. $mysqli->close();
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement