in reply to Re^9: CGI Action call
in thread CGI Action call
See what you are saying
If the stmt was
my $stmt = "SELECT * FROM users WHERE ? = ? ORDER BY ? +ASC";
instead, it would fail with
$sth->execute($searchfield, $searchterm, $searchfield) or die "Unable +to execute + query: " . $sth->errstr;
But this works as the field name is assigned early.
[Mon Mar 19 19:01:04 2018] update_tables.cgi: statement = 'SELECT * F +ROM users WHERE lastname = ? ORDER BY ? ASC' at update_tables.cgi lin +e 462.
So what would be lost by simply using:
'SELECT * F +ROM users WHERE $searchfield = $searchterm ORDER BY $searchfield ASC'
where all the parameter would be defined at prepare?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: CGI Action call
by Corion (Patriarch) on Mar 20, 2018 at 09:50 UTC | |
by tultalk (Monk) on Mar 20, 2018 at 11:28 UTC | |
by poj (Abbot) on Mar 20, 2018 at 11:41 UTC | |
by davies (Monsignor) on Mar 20, 2018 at 12:59 UTC | |
|
Re^11: CGI Action call
by marto (Cardinal) on Mar 20, 2018 at 10:08 UTC |