title: How i can get notification when database update from another browser / computer
body: <p><img src="https://i.stack.imgur.com/vQ7pG.png" alt="enter image description here"><br>**My Question **
  while chatting on Facebook , when u receive a message from someone, you get a notification showing number of new messages with red background.
  so my question is how we can do so that we recieve a notification when database is changed from another computer.
  I done it with the following codes and it work well but it seem harmful for processor as it run mysql query each second.</p>
  
  <p>the following jquery code</p>
  
  <pre><code>$(document).ready(
              function() {
                  setInterval(function() {
                      $.ajax({
                          url: 'incs/check_new_msg.php' ,
                          cache: false,
                          success: function(data)
                          {
                              $('#orders').html(data);
                          },
  
                      });
                  }, 1000);
              });
  </code></pre>
  
  <p>in check__new_msg.php i use query
  select count(id) from inbox where status = '1' 
  then i echo its result</p>