in reply to CGI and DBI, new to me...
RaiseError:
$dbh = DBI->connect($dsn, $user, $password, { RaiseError => 1, AutoCommit => 0 });
Placeholders:
my $sth = $dbh->prepare(q{ INSERT INTO sales (product_code, qty, price) VALUES (?, ?, ?) }) or die $dbh->errstr; while (<>) { chomp; my ($product_code, $qty, $price) = split /,/; $sth->execute($product_code, $qty, $price) or die $dbh->errstr; } $dbh->commit or die $dbh->errstr;
Both snippets lifed with care from the official doco.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: CGI and DBI, new to me...
by dga (Hermit) on Dec 13, 2002 at 22:59 UTC |