Home : General : Perl Programming :

General: Perl Programming: Re: [RedRum] $sth->fetchall_array: Edit Log

Here is the list of edits for this post
Re: [RedRum] $sth->fetchall_array
$sqlquery= "SELECT Email FROM Members";

$sth = $dbh->prepare($sqlquery);
my $records = $sth->fetchall_arrayref({});

for my $record (@$records) {

# fieldvalue = $record->{'fieldname'}


Or you can define your variables before hand:

while ($pointer = $sth->fetchrow_hashref) {
$field_value = $pointer->{'field_name'};

print "blah blah $field_value blah";

Read the documentation on the use of fetchall_arrayref({});, though. You'll find that fetchrow_arrayref is a faster way to fetch your data.


Last edited by:

Wil: Sep 28, 2001, 2:12 AM

Edit Log: