Okay, so I have a page that displays a table listing all the books that I have Read. A user can check a checkbox off next to each one. If they submit it the books are added to a different database. Anyways, what I need help with it is allowing the user to order the table by the columns that are shown here (on the same page). I want to just make the column titles hyperlinks at which point they can select a column heading, it'll reload the page sorted by that heading. Reverse order would be nice on second click, but not needed.
I look around for tutorials for this, but couldn't find any or at least not ones that were simple enough for me to understand and apply to my own. Help is greatly appreciated.
Oh and when I say hyperlinks, I guess I just mean look like. I heard there was a way to do it with forms which is fine for me and it basically makes a button look like a hyperlink.
My code for the page:
<?php
global $user;
$db = mysql_connect("localhost", "collin","MYPASSWORD");
mysql_select_db("mydatabase_name",$db);
//add books to database that are checked
$query="SELECT a.book, a.rarity, a.price, a.sid FROM collector_books a LEFT JOIN collector_books_read b ON a.sid = b.sid and b.uid = $user->uid WHERE b.sid IS NULL";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$sid=mysql_result($result,$i,"sid");