title: Long polling - Message system
body: <p>I'm looking into doing some long polling with jQuery and PHP for a message system. I'm curious to know the best/most efficient way to achieve this. I'm basing is off this <a href="https://stackoverflow.com/questions/333664/simple-long-polling-example-code">Simple Long Polling Example</a>.</p>
  
  <p>If a user is sitting on the inbox page, I want to pull in any new messages. One idea that I've seen is adding a <code>last_checked</code> column to the message table. The PHP script would look something like this:</p>
  
  <pre><code>query to check for all null `last_checked` messages
  if there are any...
  while(...) {
      add data to array
      update `last_checked` column to current time
  }
  send data back
  </code></pre>
  
  <p>I like this idea but I'm wondering what others think of it. Is this an ideal way to approach this? Any information will be helpful!</p>
  
  <p>To add, there are no set number of uses that could be on the site so I'm looking for an efficient way to do it.</p>