djlerman has asked for the wisdom of the Perl Monks concerning the following question:
@input = (); $string = "abc"; push(@input, '%' . $string . '%'); $sth=$dbh->prepare("SELECT * FROM table WHERE field LIKE ?") or die $dbh->errstr; $sth->execute(@input) or die $dbh->errstr;
Thank You. 🙏@input = (); $string = "1,2,3"; push(@input, $string); $sth=$dbh->prepare(" SELECT * FROM table WHERE field IN (?) ") or die $dbh->errstr; $sth->execute(@input) or die $dbh->errstr;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sql bind parameterization clarity
by Corion (Patriarch) on Aug 26, 2022 at 18:21 UTC | |
by erix (Prior) on Aug 26, 2022 at 20:02 UTC | |
by djlerman (Beadle) on Sep 01, 2022 at 15:39 UTC |