Guest User

Untitled

a guest
Mar 27th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>DB</title>
  6. </head>
  7. <body>
  8.  
  9. <table>
  10. <tr>
  11. <th>id</th>
  12. <th>name</th>
  13. <th>age</th>
  14. <th>salary</th>
  15. </tr><br>
  16. <?php
  17.  
  18. $host = 'localhost';
  19. $user = 'root';
  20. $pass = '123QWErty';
  21. $db_name ='test_db' ;
  22. $table = '`people`';
  23.  
  24. $link = mysqli_connect($host, $user, $pass, $db_name) or die (mysqli_error($link));
  25. mysqli_set_charset($connect, 'utf8');
  26.  
  27. $query = " SELECT * FROM $table";
  28.  
  29. $mysqlquery = mysqli_query($link, $query);
  30. mysqli_close($link);
  31.  
  32.  
  33. while ($result = mysqli_fetch_array($mysqlquery, MYSQLI_ASSOC)) {
  34.  
  35.  
  36. echo "<tr><td>$result['id']</td><td>$result['name']</td><td>$result['age']</td><td>$result['salary']</td></tr><br>";
  37.  
  38. }
  39.  
  40.  
  41. ?>
  42. </table>
  43.  
  44. </body>
  45.  
  46. </html>
Add Comment
Please, Sign In to add comment