Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.19 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php
  3.  
  4. $host = "localhost";
  5. $username = "redacted";
  6. $password = "redacted";
  7. $db = "redacted";
  8.  
  9. $connection = mysqli_connect($host, $username, $password, $db);
  10.  
  11. if (mysqli_connect_errno()) {
  12.  echo "Connection error";
  13. }
  14.  
  15. $query = "SELECT * FROM main";
  16.  
  17. $result = $connection->query($query);
  18.  
  19. ?>
  20.  
  21. <html>
  22.   <head>
  23.     <title>Test Page</title>
  24.   </head>
  25.   <body>
  26.     <h1>Test Main Table Display</h1>
  27.     <table>
  28.       <?php
  29.      // first instance
  30.      while($row = mysqli_fetch_array($result)) {
  31.        echo "<tr>";
  32.         echo "<td>" . $row['user'] . "</td>";
  33.         echo "<td>" . $row['date'] . "</td>";
  34.         echo "<td>" . $row['count'] . "</td>";
  35.         echo "<td>" . $row['action'] . "</td>";
  36.         echo "<td><button>Expand</button></td>";
  37.         echo "</tr>";
  38.       }
  39.       ?>
  40.     </table>
  41.     <h1>Test User Entry Appendment</h1>
  42.     <form>
  43.       <label>Select a user, or add a new user.</label><br>
  44.       <select>
  45.         <?php
  46.        // second instance
  47.        while($row = mysqli_fetch_array($result)) {
  48.          echo "<option>" . $row['user'] . "</option>";
  49.         }
  50.         ?>
  51.       </select>
  52.     </form>
  53.   </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement