Peter Landis wrote:
>
>
> How do you sort by the variable?
>
> $sqh = $dbh->prepare(q{select name from company order
> by $sort_selection;});
> $sqh->execute();
Your problem is not Perl specific. The order by column
must be in the result set (projection). Why not doing
it this way:
my @fields = qw/name zip location/;
push @fields, $sort_selection;
$sqh = $dbh->prepare( "SELECT " . join(', ', @fields) .
" FROM company ORDER BY $sort_selction; );
$sqh->execute();
Greetings Herbie
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Herbert Liechti E-Mail: [EMAIL PROTECTED]
ThinX networked business services Stahlrain 10, CH-5200 Brugg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~