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:
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") ;
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") ;