title: trigger a function when changes in the DB are being commited
body: <p>I was always wondering if it's possible to create a block of code (probably php code) that will execute when a certain change is being committed to the database.</p>
  
  <p>For instance, chat application. When a user sends a message, it will add a message to a table, then I would like to force all of the other users to an AJAX request to read this new value (rather than sending AJAX request every 100ms to check if there is a new message)</p>
  
  <p>I remember something that involved node.js and some other type of DB rather than mysql. If this is the only solution, can it work along with a normal mysql database?</p>
  
  <p>Thanks in advance!</p>