title: SQL LIMIT VS Loop Limit
body: <p>I was browsing around Stack Overflow attempting to find how to limit an SQL query with a while loop and I came across this code.</p>
  
  <pre><code>$count = 0;
  
  while ($count &lt; 4 &amp;&amp; $info = mysql_fetch_assoc($result)) {
      //stuff
  
      $count++;
  }
  </code></pre>
  
  <p><strong>Q 1:</strong> What is the difference between this code and using the SQL <code>LIMIT</code> clause?</p>
  
  <p><strong>Q 2:</strong> For what reason would somebody want to use this code, rather than using <code>LIMIT</code>?</p>