in reply to Hidden Secrets of PERL
As you know, this isn't safe (sql Piggybacking)my $sql = join(",", @allsearchterms); my $sth = $dbh->prepare("select * from table where value in($sql)"); # You need to place qutes arount the sql-items, but you'll get the poi +nt here... $sth->execute();
As you see, a neat feature of Perl :)my $qm = join ',', ('?') x @allsearchterms; my $sth = $dbh->prepare("select * from table where value in($qm)"); $sth->execute(@allsearchterms);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hidden Secrets of PERL
by Hue-Bond (Priest) on Oct 12, 2006 at 10:24 UTC |