At 09:30 AM 08/27/2003, Johnson, Shaunn wrote:
--Thanks for the reply:

--I think I'm well on my way, but, I'm looking
--at the results and the 'Programming the PERL DBI'
--book and it says that selectrow_array returns the
--value of the first field.

--selectall_arrayref and selectcol_arrayref
--doesn't seem to help.

--how can I return all of the fields that
--was selected?

Sorry, I missed the first bit of this thread...


Is this what you are looking for?

my $SQL = qq[
select ID, CusName, OtherField
  from myTable
];

my $sth = $dbh->prepare($SQL)||print "$SQL";
   $sth->execute||exit print "Could not execute:\n
                               $SQL\n";

while ( my ( $id, $cusname, $otherfield ) )
        = $sth->fetchrow ) {
  do some things here with new variables
}

...

that's my favorite way, or you can replace list of variable names with an array like @columns and then refer to them by $columns[0] $columns[1] etc...


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to