title: How to sort MySql rows of HTML table headers
body: <p>I have an html table that contains data retrieved from this sql statement:</p>
  
  <pre><code>$sql = "SELECT log_date, log_id, log_time, network_protocal, client_name, client_ip FROM log_table";
  </code></pre>
  
  <p>The HTML is:</p>
  
  <pre><code>&lt;div class="container"&gt;
  
  &lt;table class="table table-striped"&gt;
      &lt;tr&gt;
          &lt;td&gt;Date&lt;/td&gt;
          &lt;td&gt;Time&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;Network Protocol&lt;/td&gt;
          &lt;td&gt;Client Name&lt;/td&gt;
          &lt;td&gt;Client IP&lt;/td&gt;
      &lt;/tr&gt;
      &lt;?php foreach ($logs as $log) { ?&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;?php if (isset($log-&gt;log_date)) echo (string)$log-&gt;log_date; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php if (isset($log-&gt;log_time)) echo (string)$log-&gt;log_time; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php if (isset($log-&gt;network_protocal)) echo (string)$log-&gt;network_protocal; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php if (isset($log-&gt;client_name)) echo (string)$log-&gt;client_name; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php if (isset($log-&gt;client_ip)) echo (string)$log-&gt;client_ip; ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;?php } ?&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p></p>
  
  <p>I would like to setup ascending and descending sort functionality by clicking on the table headers but I can't seem to find a simple solution for this. Can someone point me in the right direction?</p>