title: Real time loop issue
body: <p>I am having problem archiving real time loop. While it going to next iteration, it should check the <code>status</code> first for an update (<code>status= 0</code>) before going to next iteration.   </p>
  
  <p>status field might be updated somewhere else...</p>
  
  <p><strong>For example:</strong></p>
  
  <pre><code>&lt;?php
  $SQL = "SELECT * FROM data WHERE status = 0";
  $query = $db-&gt;prepare($SQL);
  $query-&gt;execute();
  
  while ($row = $query-&gt;fetch(PDO::FETCH_ASSOC)) {
      print_r($row);
      print("\n\n");
      sleep(5);
  }
  ?&gt;
  </code></pre>
  
  <p>While php script is running/looping, in mysql console, I quickly did:</p>
  
  <pre><code>UPDATE data SET status = 1
  </code></pre>
  
  <p>It is still showing all the records even I have updated the status. How can that problem be fixed?</p>