Advertisement
Guest User

Untitled

a guest
Mar 13th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Messages</title>
  4. </head>
  5. <body style="background-color:lightblue;" onload="setTimeout('document.location.reload();', 5000);">
  6. <script>
  7. function refreshPage() {
  8. $.mobile.changePage(
  9. window.location.href,
  10. {
  11. allowSamePageTransition : true,
  12. transition : 'none',
  13. showLoadMsg : false,
  14. reloadPage : true
  15. }
  16. );
  17. }
  18. </script>
  19. <?php
  20. $servername = "localhost";
  21. $username = "****";
  22. $password = "****";
  23. $dbname = "****";
  24.  
  25. // Create connection
  26. $conn = new mysqli($servername, $username, $password, $dbname);
  27. // Check connection
  28. if ($conn->connect_error) {
  29. die("Connection failed: " . $conn->connect_error);
  30. }
  31.  
  32. $sql = "SELECT Name, Message FROM Messages ORDER BY Id DESC";
  33. $result = mysqli_query($conn, $sql);
  34.  
  35. if (mysqli_num_rows($result) > 0) {
  36. // output data of each row
  37. while($row = mysqli_fetch_assoc($result)) {
  38. echo "<div class='textfont'><font color='blue' size='3pt'><b><i>";
  39. echo $row["Name"];
  40. echo ": </i></b></font>";
  41. echo $row["Message"];
  42. echo "</div><hr>";
  43. }
  44. } else {
  45. echo "There is no new messages on chat";
  46. }
  47. $conn->close();
  48. ?>
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement