title: LIMIT results in MySQL?
body: <p>ok; this has been frying my brain for hours.  I think I might need a sub query, but I'm not that advanced at this kind of thing so any help or pointers in the right direction would be greatly appreciated.</p>
  
  <p>Here's the Query I have....</p>
  
  <pre><code>$query = "SELECT * FROM events WHERE event_type = 'Christmas Listings' AND event_active='Yes' ORDER BY event_date ASC LIMIT 5";
  $result= mysql_query($query); 
  </code></pre>
  
  <p>OK... now for the plain english bit on what I want to achieve (to understand what I'm trying to achieve):</p>
  
  <ol>
  <li><p>I want to check the event type ('<code>event_type</code>') is what I'm getting (ie. Christmas Listings) as there are multiple types in this column.</p></li>
  <li><p>I want to check the event is active ('<code>event_active</code>') is Yes(the data in this field is Yes/No).</p></li>
  <li><p>I want to order them by the ('<code>event_date</code>') ASC (the data in this field is <code>yyyy-mm-dd</code>) so they show the latest entry by its date from the DB.</p></li>
  <li><p>I want to LIMIT (or in some way control the output) the results to only have 5 results displayed when running this kind of query through a WHILE statement.</p></li>
  </ol>
  
  <p>OK, this all works BUT; when I get to the actual output display, i'm having a shaky output in how many results are actually display... What happens is if I have multiple events which are switched off, as in <code>event_active</code> is '<code>Off</code>' then its almost like the argument is counting from the all the results that are (including <code>event_active='Off'</code>) and consequently not showing how I expect them to display?</p>
  
  <p>Hope this makes sense.... Any help would be gratefully received.</p>