Advertisement
Guest User

Untitled

a guest
Apr 7th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. function commit_crime()
  2. {
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "";
  6. $dbname = "pgdatabase";
  7. $conn = new mysqli($servername, $username, $password, $dbname);
  8.  
  9. if ($conn->connect_error) {
  10. die("Connection failed: " . $conn->connect_error);
  11. }
  12.  
  13. $sql = "SELECT id, username, password, itime FROM users";
  14. $result = mysqli_query($conn, $sql);
  15.  
  16. if ($result->num_rows > 0) {
  17. echo "<table><tr><th>ID</th><th>Name</th></tr><th><tr>Password</tr></th>";
  18. // output data of each row
  19. while($row = $result->fetch_assoc()) {
  20. echo "<tr><td>".$row["id"]."</td><td>".$row["username"]." ".$row["password"]."</td></tr>";
  21. }
  22. echo "</table>";
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement