Guest User

Untitled

a guest
Sep 8th, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. $dbServername = "localhost";
  2. $dbUsername = "root";
  3. $dbPassword = "";
  4. $dbName = "phplessons";
  5.  
  6. $conn = "mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName)";
  7.  
  8. ?>
  9.  
  10. <?php
  11. include_once 'includes/dbh.inc.php';
  12. ?>
  13.  
  14. <!DOCTYPE html>
  15. <html>
  16. <body>
  17.  
  18. <?php
  19. $sql = "SELECT * FROM posts;";
  20. $result = mysqli_query($conn, $sql);
  21. $resultCheck = mysqli_num_rows($result);
  22.  
  23. if($resultCheck > 0) {
  24. while ($row = mysqli_fetch_assoc($result)) {
  25. echo $row['subject'];
  26. }
  27. }
  28. ?>
  29.  
  30. </body>
  31. </html>
Add Comment
Please, Sign In to add comment