Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2.  
  3. $link = mysqli_connect("localhost","root","","firstdbase");
  4.  
  5. if($link===false){
  6. die("error:could not connect. " . mysqli_connect_error());
  7. }
  8.  
  9.  
  10. $sql = "SELECT * FROM tbl_username";
  11.  
  12. if($result = mysqli_query($link, $sql)){
  13.  
  14. if(mysqli_num_rows($result) > 0){
  15.  
  16. echo "<table class='table table-bordered table-responsive'>";
  17. echo "<tr>";
  18. echo "<th>ID</th>";
  19. echo "<th>Username</th>";
  20. echo "</tr>";
  21.  
  22. while ($row = mysqli_fetch_array($result)) {
  23.  
  24. echo "<tr>";
  25. echo "<td>" .$row['ID']. "</td>";
  26. echo "<td>" .$row['username']. "</td>";
  27. echo "</tr>";
  28. }
  29. echo "</table>";
  30.  
  31. mysqli_free_result($result);
  32. }
  33. else
  34. {
  35. echo "No records found";
  36. }
  37. }
  38. else{
  39. echo "Error: could not able to execute " .mysqli_error($link);
  40. }
  41.  
  42. mysqli_close($link)
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement