Guest User

Untitled

a guest
Jan 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. <?php include_once('base.php'); ?>
  2.  
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <title>Attendance Sheet</title>
  7. <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
  8. <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-theme.min.css">
  9. </head>
  10. <body>
  11. <div class="jumbotron invert">
  12. <div class="container">
  13. <h1> Attendance Sheet </h1>
  14. </div>
  15. </div>
  16. <div class="container">
  17. <table class="table table-bordered">
  18. <tr>
  19. <th>ID Number</th>
  20. <th>First Name</th>
  21. <th>Middle Name</th>
  22. <th>Last Name</th>
  23. <th>Contact Number</th>
  24. <th>Course</th>
  25. <th>Year</th>
  26. </tr>
  27.  
  28. <?php
  29. $stmt = $db->query("SELECT * FROM attendance_sheet");
  30. $stmt->execute();
  31. for ($x=1;$x<=100;$x++){
  32. echo $x.$student['ID Number'];
  33. foreach ($stmt as $student) {
  34. ?>
  35.  
  36. <tr>
  37. <td><?=$student['ID Number']?></td>
  38. <td><?=$student['First Name']?></td>
  39. <td><?=$student['Middle Name']?></td>
  40. <td><?=$student['Last Name']?></td>
  41. <td><?=$student['Contact Number']?></td>
  42. <td><?=$student['Course']?></td>
  43. <td><?=$student['Year']?></td>
  44. </tr>
  45.  
  46. <?php
  47. }
  48. }
  49. ?>
  50.  
  51. </table>
  52. </div>
  53.  
  54. <script src="bootstrap/js/jquery-3.1.1.js"></script>
  55. <script src="bootstrap/js/bootstrap.min.js"></script>
  56. </body>
  57. </html>
  58.  
  59. <?php
  60.  
  61. $host = "localhost";
  62. $user = "root";
  63. $pass = "";
  64. $db_name = "assign_attndncesht";
  65.  
  66. try{
  67. $db = new PDO("mysql:host={$host};dbname={$db_name}",$user,$pass);
  68. $db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
  69. echo "You are connected to database".$db_name;
  70. }
  71. catch(PDOException $e)
  72. {
  73. echo $e->getMessage();
  74. }
  75. ?>
  76.  
  77. <?php
  78. echo '<td>' . $x.$student['ID Number'];
  79. ?>
Add Comment
Please, Sign In to add comment