Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <link rel="stylesheet" media="screen" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
  8.  
  9. <title>Minimum Bootstrap HTML Skeleton</title>
  10.  
  11. <!-- -->
  12.  
  13. <style>
  14. #notification_count {
  15. padding: 0px 3px 3px 7px;
  16. background: #cc0000;
  17. color: #ffffff;
  18. font-weight: bold;
  19. margin-left: 77px;
  20. border-radius: 9px;
  21. -moz-border-radius: 9px;
  22. -webkit-border-radius: 9px;
  23. position: absolute;
  24. margin-top: -1px;
  25. font-size: 10px;
  26. }
  27. </style>
  28.  
  29. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript" charset="utf-8"></script>
  30. <script type="text/javascript" charset="utf-8">
  31. function addmsg(type, msg) {
  32.  
  33. $('#notification_count').html(msg);
  34.  
  35. }
  36.  
  37. function waitForMsg() {
  38.  
  39. $.ajax({
  40. type: "GET",
  41. url: "select.php",
  42.  
  43. async: true,
  44. cache: false,
  45. timeout: 50000,
  46.  
  47. success: function(data) {
  48. addmsg("new", data);
  49. setTimeout(
  50. waitForMsg,
  51. 1000
  52. );
  53. },
  54. error: function(XMLHttpRequest, textStatus, errorThrown) {
  55. addmsg("error", textStatus + " (" + errorThrown + ")");
  56. setTimeout(
  57. waitForMsg,
  58. 15000);
  59. }
  60. });
  61. };
  62.  
  63. $(document).ready(function() {
  64.  
  65. waitForMsg();
  66.  
  67. });
  68. </script>
  69.  
  70.  
  71.  
  72. <script type="text/javascript">
  73. $(function getNotification() {
  74.  
  75.  
  76.  
  77. $.ajax({
  78. type: "POST",
  79. url: "update.php",
  80.  
  81. });
  82.  
  83.  
  84.  
  85.  
  86. });
  87. </script>
  88. <span id="notification_count"></span>
  89. <a href="#" id="notificationLink" onclick="return getNotification()">Notifications</a>
  90. <div id="HTMLnoti" style="textalign:center"></div>
  91.  
  92. </head>
  93.  
  94. <body>
  95.  
  96. <div class="container">
  97.  
  98. </div>
  99.  
  100. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  101. <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
  102.  
  103. <script>
  104. </script>
  105.  
  106. </body>
  107.  
  108. </html>
  109.  
  110. <?php
  111. $servername = "localhost";
  112. $username = "root";
  113. $password = "root";
  114. $dbname = "aaa";
  115.  
  116. // Create connection
  117.  
  118. $conn = new mysqli($servername, $username, $password, $dbname);
  119.  
  120. // Check connection
  121.  
  122. if ($conn->connect_error) {
  123.  
  124. die("Connection failed: " . $conn->connect_error);
  125.  
  126. }
  127.  
  128. $sql = "SELECT * from tbl_noti where status = 'unread'";
  129. $result = $conn->query($sql);
  130. $row = $result->fetch_assoc();
  131. $count = $result->num_rows;
  132. echo $count;
  133. $conn->close();
  134. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement