in reply to Tricks with DBI
My way is similar but not the same (I include just the different part):
my $sth = $dbh->prepare_cached(<<SQL); select id, name, phone from people where birth_month = ? SQL for my $month (@months) { print "People born in $month:\n"; my($id, $name, $phone); # Execute the statement for this $month $sth->execute($month); $sth->bind_columns(\$id, \$name, \$phone); # Also valid: $sth->bind_columns(\($id, $name, $phone)); # Fetch each row and print out the values while ($sth->fetch) { print "\t", join("\t", $id, $name, $phone), "\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: RE: Tricks with DBI
by btrott (Parson) on May 31, 2000 at 20:43 UTC | |
Re^2: Tricks with DBI
by locked_user vperacto (Initiate) on May 19, 2016 at 10:17 UTC |