Hello All! I’m stuck trying to figure out how to be able to use one link and sort my sql query either ASC or DESC based upon what is sorted currently. (e.g. clicking the link sorts the opposite of the current sorted column) I am extremly new to this and below is the closest i’ve came… It doesn’t work the way i was hoping… I just want to use column headings as links to and once click they sort by default asc then desc if clicked again.
here’s how i am first reading the $direction variable and see if its set
[php]
$direction = $_GET[‘direction’];
if (!isset($direction))
{$direction = ‘DESC’;}
else if ($direction = ‘DESC’)
{$direction = ‘ASC’;}
[/php]
Then i have my link for the column like below… the theory here is it would pass the current direction (default is desc) and then switch it to asc (eventually vica versa too)…
[php]
ArtifactID
[/php]
Any ideas or easier way to do this?