Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <html>
  2.  
  3. <body>
  4.  
  5.  
  6.  
  7.  
  8. <form action="sign.php" method="post">
  9.  
  10.  
  11.  
  12.  
  13. <input name="username" type="text" placeholder="Username">
  14. <input name="password" type="password" placeholder="Password">
  15.  
  16.  
  17.  
  18. <button name="submit" type="submit">SIGN UP</button>
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. </form>
  34.  
  35.  
  36.  
  37.  
  38. <?php
  39.  
  40. $servername = "localhost";
  41. $username = "root";
  42. $password = "";
  43. $databasename = "loginfromscratch";
  44.  
  45. $connection = new mysqli($servername, $username, $password, $databasename);
  46.  
  47.  
  48.  
  49. //Get number of rows
  50. $sql="SELECT * FROM users";
  51. $result=mysqli_query($connection, $sql);
  52. $i=1;
  53. while($row=mysqli_fetch_assoc($result))
  54. {
  55.  
  56. $date[$i] = $row['user_username'];
  57. $period[$i] = $row['user_password'];
  58. $i++;
  59. }
  60. //Start table
  61. echo "<table>";
  62. echo "<tr><th>Date</th><th>Period</th><th>Room</th><th>Teacher Initials</th></tr>";
  63.  
  64. // Loop through the results from the database
  65. for ($i = 1; $i <=count($date); $i++)
  66. {
  67.  
  68. // Show entries
  69. echo
  70. "<tr>
  71. <td>$date[$i]</td>
  72. <td>$period[$i]</td>
  73. </tr>";
  74.  
  75. }
  76.  
  77.  
  78. echo "</table>"
  79.  
  80. ?>
  81.  
  82. </body>
  83.  
  84.  
  85.  
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement