View Single Post
Old 06-07-2005, 07:08 PM   #6 (permalink)
jaswinder_rana
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

Using 2 different techniques (ASC & DESC) is not impossible, but its going to take a lot of tihinking

for example

page.php?order=name&method=asc
page.php?order=phone&method=asc
page.php?order=postal&method=asc

say, i have above 3 links.so, for sorting you already got it and ASC is the default. now, if you want to do desc too, then when you choose the order you also need to change the method to DESC for next time.
PHP Code:
switch($_GET['order'])
{
 case 
name:
  
$order 'name';
  
$method = ($_GET['method'] == 'ASC')?'DESC:'ASC';
}

$query = "select * from table order by $order $method"; 
So, for next time now you have to change THAT PARTICULAR link to DESC, so when next time you click it, it also orders but this time it orders by DESC


i know its not clear. but, i couldn't find an example to support it
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote