Guest User

Untitled

a guest
Mar 22nd, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. // connect.php
  2. <?php
  3. $connection = mysqli_connect('localhost', 'root', 'root', 'loginapp');
  4. if(!$connection) {
  5. die("Database connection failed");
  6. }
  7. ?>
  8.  
  9.  
  10. // showDb.php
  11. <?php include 'connect.php' ?>
  12. <?php
  13. function showAllData() {
  14. global $connection;
  15. $query = "SELECT * FROM users";
  16. $result = mysqli_query($connection, $query);
  17. if(!$result) {
  18. die("error");
  19. }
  20.  
  21. while($row = mysqli_fetch_row($result)) {
  22. //$id = $row['id'];
  23. //echo "<option value='$id'>$id</option>";
  24. print_r($row);
  25. }
  26.  
  27. }
  28. ?>
Add Comment
Please, Sign In to add comment