Advertisement
Guest User

Untitled

a guest
Feb 4th, 2018
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <?php session_start();
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "cs455";
  6.  
  7. $conn = new mysqli($servername, $username, $password, $dbname);
  8. if ($conn->connect_error) {
  9. die("Connection failed: " . $conn->connect_error);
  10. }
  11. ?>
  12. <!DOCTYPE html>
  13. <html>
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  16. <title></title>
  17. </head>
  18. <body>
  19. <?php
  20. $sql = "SELECT * FROM reservations order by roomnumber";
  21. $result = $conn->query($sql);
  22.  
  23. echo "<table border='1'>
  24. <tr>
  25. <th>Room Number</th>
  26. <th>Email</th>
  27. <th>Headcount</th>
  28. <th>Start</th>
  29. <th>End</th>
  30. <th>Comment</th>
  31. </tr>";
  32.  
  33. while ($row = $result->fetch_assoc()) {
  34. echo "<tr>";
  35. echo "<td>" . $row['roomnumber'] . "</td>";
  36. echo "<td>" . $row['email'] . "</td>";
  37. echo "<td>" . $row['headcount'] . "</td>";
  38. echo "<td>" . $row['start'] . "</td>";
  39. echo "<td>" . $row['end'] . "</td>";
  40. echo "<td>" . $row['comment'] . "</td>";
  41. echo "</tr>";
  42. }
  43. echo "</table>";
  44.  
  45. $conn->close();
  46. ?>
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement