Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta charset="UTF-8">
  4. <title>List of Users</title>
  5. </head>
  6. <body>
  7. <h1>Pick a user. Any user. I dare you.</h1>
  8. <table>
  9. <thead>
  10. <tr>
  11. <td>Usernames:</td>
  12. </tr>
  13. </thead>
  14. <tbody>
  15. <?php
  16. $host = "localhost";
  17. $user = "test1";
  18. $pass = "1kozlovsas";
  19. $db = "test1";
  20.  
  21. $con = pg_connect("host=$host dbname=$db user=$user password=$pass")
  22. or die ("Could not connect to server\n");
  23.  
  24. $query = "SELECT username FROM ass1dat";
  25. $rs = pg_query($con, $query) or die("Cannot execute query: $query\n");
  26.  
  27. while ($row = pg_fetch_row($rs)) {
  28. echo '<tr>
  29. <td>
  30. <a href="userdetails.html?username='.$row[0].'">
  31. <button type="button" class="btn btn-info">'.$row[0].'</button>
  32. </a>
  33. </tr>';
  34. }
  35. pg_close($con);
  36. ?>
  37. </tbody>
  38. </table>
  39.  
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement