Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my $sql = "select name,address,phone,email from my table where name='m +ary'"; my $allnames= $dbh->exec_select( $sql ) or die "Couldn't execute state +ment: $dbh->errstr";; if(@$allnames) { for (my $i = 0; $i < @$allnames; $i++) { my $allname = $allnames->[$i]{ 'name' } || ''; my $alladdress = $allnames->[$i]{ 'address' } || ''; my $allphone= $allnames->[$i]{ 'phone' } || ''; my $allemail = $allnames->[$i]{ 'email' } || ''; $AoH{ alldata } = $allname." ".$alladdress." ".$all +phone ." ".$allemail; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fetching DB using a While loop.
by almut (Canon) on Apr 20, 2010 at 18:30 UTC | |
|
Re: Fetching DB using a While loop.
by leighsharpe (Monk) on Apr 21, 2010 at 00:33 UTC |