- or download this
my $dbname = 'production';
my $username = 'code_monkey';
...
# You can even call a completely different RDBMS
my $dbh_baz = DBI->connect("dbi:Pg:host=baz;dbname=$dbname",$username,
+$password );
- or download this
my $pet = '5" Stuffed Camel';
my $sql = 'SELECT id,name FROM users WHERE has_pet = ?';
...
my $sth_sel = $dbh->prepare($sql);
$sth_sel->execute($pet);
# Now $pet is properly quoted
- or download this
my $sql = 'SELECT id,name FROM users WHERE has_pet = ?';
my $sth_sel = $dbh->prepare($sql);
foreach my $pet (qw/ monkey bear tiger /) {
$sth_sel->execute($pet);
}