Guest User

Untitled

a guest
Apr 2nd, 2019
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <<?php
  2. $servername = "localhost";
  3. $username = "s113484_keuze";
  4. $password = "RkVFl8qk";
  5. $dbname = "s113484_keuze";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. // sql to delete a record
  15. $sql = "Select * from leerlingen";
  16. $result = $conn->query($sql);
  17.  
  18.  
  19. ?>
  20. <html>
  21. <head>
  22. <style>
  23. table {
  24. font-family: arial, sans-serif;
  25. border-collapse: collapse;
  26. width: 100%;
  27. }
  28.  
  29. td, th {
  30. border: 1px solid #dddddd;
  31. text-align: left;
  32. padding: 8px;
  33. }
  34.  
  35. tr:nth-child(even) {
  36. background-color: #dddddd;
  37. }
  38. </style>
  39. </head>
  40.  
  41. <body>
  42. <?php foreach($row = $result->fetch_assoc()): ?>
  43.  
  44. <table>
  45. <tr>
  46. <th>Voornaam</th>
  47. <th>Achternaam</th>
  48. <th>klas</th>
  49. <th>Profiel</th>
  50. <th>Commentaar</th>
  51. <th>Datum</th>
  52. </tr>
  53. <tr>
  54. <td><?php echo $row['voornaam']; ?></td>
  55. <td><?php echo $row['achternaam'];?></td>
  56. <td><?php echo $row['klas'];?></td>
  57. <td><?php echo $row['profiel'];?></td>
  58. <td><?php echo $row['tijd'];?></td>
  59. </tr>
  60. <?php endforeach; ?>
  61. </table>
  62. </body>
  63. </html>
  64. <?php
  65.  
  66. $conn->close();
  67. ?>
RAW Paste Data