Advertisement
Guest User

Untitled

a guest
Apr 13th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. $host = "localhost";
  4. $user = "root";
  5. $pass = "";
  6. $db = "sample";
  7.  
  8. $connection = new mysqli($host, $user, $pass, $db);
  9.  
  10. if($connection->connect_error)
  11.     die ($connection->connect_error);
  12.  
  13. $sql = "SELECT * FROM `user` WHERE 1";
  14.  
  15. $out = $connection->query($sql);
  16.  
  17. if($out->num_rows > 0)
  18. {
  19.     while($row = $out->fetch_assoc())
  20.         echo "Name: " . $row["first_name"]. " " . $row["last_name"] . "<br/ >";
  21.    
  22. }
  23. else echo "No Result";
  24.  
  25.  
  26. $connection->close();
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement