title: Ajax request max execution timing out
body: <p>While using this code to gather data using an Ajax XHTMLRequest I'm getting an PHP Max execution timeout</p>
  
  <pre><code>if(isset($_GET['func']) and $_GET['func'] == 'feed') {
      global $ado;
      $old_msg_id = $_GET['old_msg_id']; 
      $result = $ado-&gt;exec("SELECT * FROM `earnings` ORDER BY `id` DESC LIMIT 1");
      while($row = $ado-&gt;fetch_assoc($result)) {
          $last_msg_id = $row['id']; 
      }
      while($last_msg_id &lt;= $old_msg_id) {
          $result = $ado-&gt;exec("SELECT * FROM `earnings` ORDER BY `id` DESC LIMIT 1");
          while($row = $ado-&gt;fetch_assoc($result)) {
              $last_msg_id = $row['id'];
          }
      }
      $response = array();
      $response['msg'] = 'new';
      $response['old_msg_id'] = $last_msg_id;
      echo json_encode($response);
  }
  </code></pre>
  
  <p>The error I'm receiving in the error_log is</p>
  
  <pre><code>PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /ajax.php on line 165
  </code></pre>
  
  <p>Line 165 is the following : </p>
  
  <pre><code>while($last_msg_id &lt;= $old_msg_id) {
  </code></pre>
  
  <p>I currently don't see a problem with the code, any hints as to what's wrong ?</p>