- or download this
my $dbh = DBI->connect('foo', 'bar', 'baz', 'mysql')
or die "Can't connect: ", $DBI::errstr;
$dbh->{RaiseError} = 1;
- or download this
my $sth = $dbh->prepare("select id from foo")
or die "Can't prepare: ", $dbh->errstr;
$sth->execute
or die "Can't execute: ", $dbh->errstr;
- or download this
select id, name, phone from people
- or download this
my($id, $name, $phone);
$sth->bind_columns(undef, \$id, \$name, \$phone);
- or download this
while ($sth->fetch) {
print join("\t", $id, $name, $phone), "\n";
}
- or download this
# Connect to the database and set the RaiseError
# attribute so that any database error will
...
$sth->finish;
$dbh->disconnect;
- or download this
use Apache::DBI;
- or download this
use DBI;