**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.
the following jquery code
$(document).ready(
function() {
setInterval(function() {
$.ajax({
url: 'incs/check_new_msg.php' ,
cache: false,
success: function(data)
{
$('#orders').html(data);
},
});
}, 1000);
});
in check__new_msg.php i use query select count(id) from inbox where status = '1' then i echo its result