Advertisement
Guest User

Untitled

a guest
Feb 14th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <!-- Required meta tags -->
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7.  
  8. <!-- Bootstrap CSS -->
  9. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  10.  
  11. <title>Speiseplan</title>
  12. </head>
  13. <body>
  14. <div class="container">
  15. <h1>Speiseplan pro Tag</h1>
  16.  
  17. <?php
  18. $servername = "127.0.0.1";
  19. $username = "ROOT";
  20. $password = "AQ";
  21. $database = "Speiseplan";
  22.  
  23. try {
  24. $conn = new PDO("mysql:host=$servername;dbname=$database", $username, $password);
  25.  
  26. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  27.  
  28. $sql = "SELECT * FROM $database";
  29.  
  30. foreach ($conn->query($sql) as $row) {
  31. echo $row['Tag']."<br />";
  32. echo $row['Menü1']."<br />";
  33. echo $row['Menü2']."<br />";
  34. echo $row['Vegetarisch']."<br />";
  35. echo $row['Dessert']."<br /><br />";
  36.  
  37. $stmt->execute();
  38. }
  39. }
  40. catch(PDOException $e) {
  41. echo "Error: " . $e->getMessage();
  42. }
  43.  
  44. ?>
  45. </div>
  46. </body>
  47. </html>
  48.  
  49. <table class="table table-hover table-dark">
  50. <thead>
  51. <tr>
  52. <th scope="col"></th>
  53. <th scope="col">Tag</th>
  54. <th scope="col">Menü1</th>
  55. <th scope="col">Menü2</th>
  56. <th scope="col">Vegetarisch</th>
  57. <th scope="col">Dessert</th>
  58. </tr>
  59. </thead>
  60. <tbody>
  61. <tr>
  62. <th scope="row">1</th>
  63. <td></td>
  64. <td>Otto</td>
  65. <td>@mdo</td>
  66. </tr>
  67. <tr>
  68. <th scope="row">2</th>
  69. <td>Jacob</td>
  70. <td>Thornton</td>
  71. <td>@fat</td>
  72. </tr>
  73. <tr>
  74. <th scope="row">3</th>
  75. <td colspan="2">Larry the Bird</td>
  76. <td>@twitter</td>
  77. </tr>
  78. </tbody>
  79. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement