in reply to Re: Using CGI params for SQL statement
in thread Using CGI params for SQL statement
use CGI qw(:standard :netscape *table); use CGI::Carp qw(fatalsToBrowser); use CGI::Pretty qw( :html3 ); use strict; my ($order_by,$sql,$order_by_check,$order_by_input); $sql = qq{SELECT * FROM TABLE}; $order_by = param('order_by'); $order_by_check = param('order_by_check'); if ($order_by) { $sql .= " ORDER BY $order_by "; if ($order_by_check eq $order_by) { $sql .= ' DESC '; $order_by_check = $order_by; } else { $sql .= ' ASC '; $order_by_input = "<INPUT TYPE=hidden NAME=order_by_check VALUE=\" +$order_by\">"; } } print header, start_html(), start_form(), center( start_table(), Tr(td(submit('order_by','FAULT_NO',)), td(submit('order_by','ISSUE')), td(submit('order_by','RESPONSE'))), end_table(), p($sql), $order_by_input, ), end_form(), end_html(); exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) 3Re: Using CGI params for SQL statement
by jeffa (Bishop) on Feb 26, 2002 at 18:14 UTC |