Advertisement
Guest User

Untitled

a guest
Jan 13th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $DB = "ogloszenia";
  6.  
  7. $conn = new mysqli($servername, $username, $password, $DB);
  8.  
  9. if ($conn->connect_error) {
  10. die("Connection failed: " . $conn->connect_error);
  11. }
  12.  
  13. $sql = "SET NAMES utf8";
  14. $conn->query($sql);
  15.  
  16. $sql = "SELECT * FROM userss";
  17. $result = $conn->query($sql);
  18.  
  19. if ($result->num_rows > 0) {
  20. while($row = $result->fetch_assoc()) {
  21. echo "id: " . $row["ID"]. " - Name: " . $row["name"]. " " . $row["e_mail"]. "<br>";
  22. }
  23. } else {
  24. echo "0 results";
  25. }
  26. $conn->close();
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement