Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2. $host="localhost"; //Add your SQL Server host here
  3. $user="root"; //SQL Username
  4. $pass=""; //SQL Password
  5. $dbname="slashcoding"; //SQL Database Name
  6. $con=mysqli_connect($host,$user,$pass,$dbname);
  7. if (mysqli_connect_errno($con))
  8. {
  9. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  10. }
  11. $result = mysqli_query($con,"SELECT name,message FROM guestbook");
  12. while($row = mysqli_fetch_array($result))
  13. { ?>
  14. <h3><?php echo $row['name']; ?></h3>
  15. <p><?php echo $row['message']; ?></p>
  16. <?php }
  17. mysqli_close($con);
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement