Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [jean] multiple sort

Quote Reply
Re: [jean] multiple sort In reply to
how would you customize this so you could have a flexible number of columns to sort by? in other words, sometimes you may want to sort by 6 fields, sometimes 2 or sometimes just 1. i get a syntax error if i leave 1..6. i tried the following but get error 500:
Code:
$self->{cgi}->{sb} = '';
my $i = 1;
if ($sb2) { $i = 2; }
if ($sb3) { $i = 3; }
my $order = join ',' => map {$self->{cgi}->{"sb$_"}.' '.$self->{cgi}->{"so$_"}} (1..$i) ;
($order) and $self->{db}->select_options ("ORDER BY $order") ;
Subject Author Views Date
Thread multiple sort mrsnyder 7319 Mar 8, 2002, 8:40 PM
Thread Re: [mrsnyder] multiple sort
jean 7143 Mar 12, 2002, 11:34 AM
Post Re: [jean] multiple sort
delicia 6410 Aug 18, 2010, 9:15 AM