title: Grouping records from while loop | PHP
body: <p>I'm trying to group down records by their priority levels, e.g.</p>
  
  <blockquote>
    <p><strong>--- Priority: High ---</strong></p>
    
    <p><em>Records...</em></p>
    
    <p><strong>--- Priority: Medium ---</strong></p>
    
    <p><em>Records...</em></p>
    
    <p><strong>--- Priority: Low ---</strong></p>
    
    <p><em>Records...</em></p>
  </blockquote>
  
  <p>Something like that, how do I do that in PHP? The while loop orders records by the priority column which has int value (high = 3, medium = 2, low = 1). e.g. <em>WHERE priority = '1'</em></p>
  
  <p>The label: <strong>"Priority: [priority level]"</strong> has to be set above the grouped records regarding their level</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>&lt;?php
  
  while($row = mysql_fetch_array($result))
  {
      echo '&lt;h1&gt;Priority Level: ' . $row['priority'] . '&lt;/h1&gt;';
      echo $row['name'];
  }
  
  ?&gt;
  </code></pre>
  
  <p>Like that piece of code - the <h1></h1> tags is the label which seperates records regarding their priority level.</p>