I have this simple code that displays the contents of a database. I want to be able to sort each column by clicking on the table header. I am new to php and mysql so any detailed info you can give would really help.
Here is the code I have so far:
<?php
$linkID = @mysql_connect("localhost","spiguy","asylum");
mysql_select_db("fantasyasylum_com_players", $linkID);
$resultID = mysql_query("SELECT * FROM qb", $linkID);
print "<table border=1><tr><th>Position</th>";
print "<th>Name</th><th>Team</th>";
print "<th>Pass Comp</th><th>Pass Att</th>";
print "<th>Pass Yds</th><th>Pass TDs</th>";
print "<th>Int</th><th>Rush Att</th><th>Rush Yds</th><th>Rush TDs</th></tr>";
while ($row = mysql_fetch_row($resultID))
{
print "<tr>";
foreach ($row as $field)
{
print "<td>$field</td>";
}
print "</tr>";
}
print "</table>";
mysql_close($linkID);
?>