title: How to sort rows of HTML table that are called from MySQL
body: <p>I know it's such a basic thing, but a Google search hasn't shown me how to re-sort the rows after clicking the <code>th</code> links.</p>
  
  <p>I've got this:</p>
  
  <pre><code>&lt;table border="1"&gt;
    &lt;tr&gt;
      &lt;th&gt;Type:&lt;/th&gt;
      &lt;th&gt;Description:&lt;/th&gt;
      &lt;th&gt;Recorded Date:&lt;/th&gt;
      &lt;th&gt;Added Date:&lt;/th&gt;
    &lt;/tr&gt;
  
  &lt;?php 
  while($row = mysql_fetch_array($result)){
      ?&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $row['type'] ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['description'] ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['recorded_date'] ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['added_date'] ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;br /&gt; 
  
  
    &lt;?php 
  }
  mysql_close();
  ?&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I need to be able to click <code>type</code> and sort alphabetically, and click on either <code>Recorded Date</code> or <code>Added Date</code> and sort by date.  I see that I need to have the MySQL queries do this, but do I set them up as conditionals with <code>a href</code> tags? </p>