in reply to single error with a dbh prepare
However, there are couple of other things I'll point out - which you can either take on board, or ignore completely ;)
Update: As has been pointed out below, placeholders are not appropriate for column names (which don't need to be quoted anyway). Have updated my example accordingly.
The above is not only much more robust and secure, it also removes the need to worry about quoting stuff - as this is automagically taken care of by the DBI.my $name = param('name'); my $sth = $dbh->prepare("SELECT foo, bar FROM $pictures_table WHERE st +ats = ? AND poster_name = ?"); $dbh->execute(2, $name);
Cheers,
Darren :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: single error with a dbh prepare
by davorg (Chancellor) on May 17, 2006 at 15:38 UTC | |
|
Re^2: single error with a dbh prepare
by kwaping (Priest) on May 17, 2006 at 17:10 UTC | |
|
Re^2: single error with a dbh prepare
by Errto (Vicar) on May 17, 2006 at 21:44 UTC |