Guest User

Untitled

a guest
Nov 29th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>Hostel Menagment System</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <link rel="stylesheet" href="style.css">
  8. <style>
  9. th,td
  10. {
  11. color:white;
  12. }
  13. div
  14. {
  15. border:10px;
  16. }
  17. </style>
  18. <div><button><a href="index.html">Back to form</a></button></div>
  19. </head>
  20.  
  21. <body>
  22. <?php
  23. $servername="localhost";
  24. $username="root";
  25. $password="";
  26. $dbname="hostel";
  27. $conn=new mysqli($servername,$username, $password,$dbname);
  28. if($conn->connect_error)
  29. {
  30. die("connectionfailed:".$conn->connect_error);
  31. }
  32.  
  33.  
  34. $sql = "SELECT * FROM details";
  35. $result = $conn->query($sql);
  36.  
  37. if ($result->num_rows > 0) {
  38. echo "
  39. <table class='table table-striped'>
  40. <thead>
  41. <tr>
  42. <th>S. No.</th>
  43. <th>Name</th>
  44. <th>E-Mail</th>
  45. <th>Roll no.</th>
  46. <th>Hostel Name</th>
  47. <th>Hostel No.</th>
  48. <th>Room No.</th>
  49. <th>Year</th>
  50. <th>Branch</th>
  51. <th>Gender</th>
  52. <th>Warden Name</th>
  53. </tr>
  54. </thead>
  55. <tbody>";
  56. while($row = $result->fetch_assoc()) {
  57. echo"
  58. <tr>
  59. <td>".$row["id"]."</td>
  60. <td>".$row["Name"]."</td>
  61. <td>".$row["Email"]."</td>
  62. <td>".$row["Roll_no"]."</td>
  63. <td>".$row["Hostel_Name"]."</td>
  64. <td>".$row["Hostel_No"]."</td>
  65. <td>".$row["RoomNo"]."</td>
  66. <td>".$row["Year"]."</td>
  67. <td>".$row["Branch"]."</td>
  68. <td>".$row["Gender"]."</td>
  69. <td>".$row["Warden_Name"]."</td>
  70. </tr>";
  71. }
  72. echo "
  73. </tbody>
  74. </table>
  75. </div>
  76. ";
  77. }
  78.  
  79. ?>
Add Comment
Please, Sign In to add comment