|
Just have a field to keep the column you want to order by and one for the current order status (ascending or descending).
Then when you click on the link do something like this (ordering by title in my example):
if($column == 'title')
{
$asc_desc = 'ASC'
} else {
$asc_desc = 'DESC'
}
$query = sprintf("SELECT * FROM table
ORDER BY %s %s", $column, $asc_desc);
Play around a bit with it and I'm sure you can figure it out. Let me know if you have more questions.
Pod.
|