I have a table on a page with 5 columns obtaining data to fill them from a Mysql DB. I want to make the column headers links which when clicked sorts the contents of the column in asc or desc order.
This is the code for my table
<table width='100%'>
<tr>
<td>Site ></td>
<td>Site Status</td>
<td>Company Name</td>
<td>City</td>
<td>State</td>
<td>Group Code</td>
</tr>
<?
for($i=0; $i <$num_results1; $i++)
{
$row = mysql_fetch_array($result2);
$siteno=$row[22];
$cname=$row[1];
$sstatus=$row[0];
$scity=$row[4];
$cstate=$row[5];
$gcode=$row[8];
?>
<tr>
<td><a class="five" href="sdetail.php?siteno=<?=$siteno?>&cname=<?=$cname?>&sstatus=<?=$sstatus?>&scity=<?=$scity?>&cstate=<?=$cstate?>&gcode=<?=$gcode?>"><font color='#EFA61F'><?=$siteno?></font></div></td>
<td><?=$sstatus?></td>
<td><?=$cname?></td>
<td><?=$scity?></td>
<td><?=$cstate?></td>
<td><?=$gcode?></td>
</tr>
<?
}
?>
</table>
column sort
Moderator: General Moderators