in reply to Using CGI params for SQL statement
In other words, in the fragment
you're always ending up with DESC. This suggests that $asc_desc isn't 'ASC', which you should be able to verify pretty quickly be viewing source for the page you're emitting, since you're putting out $asc_desc in a hidden field.if ($asc_desc eq 'ASC') { $sql .= " ORDER BY $order_by ASC "; } else { $sql .= " ORDER BY $order_by DESC "; }
What RDBMS are you using? If you're using MySQL, 'ASC' is the default sort order, and you only add DESC to alter the order.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Using CGI params for SQL statement
by maderman (Beadle) on Feb 26, 2002 at 08:16 UTC |