Andrew Gaffney <[EMAIL PROTECTED]> wrote:
: My boss wants me to write a script that will allow him to browse
: through the customers in our DB alphabetically. He wants all the
: customer's information to display on the page. I wrote the following
: as part of the script. I get the error 'Can't coerce array into hash'
: at the first 'if' into the loop. What am I doing wrong?
: : my $sth2 = $dbh->prepare("SELECT id FROM people ORDER BY lname,
: fname, mname"); $sth2->execute;
: my $people = $sth2->fetchall_arrayref;
What does $people look like?
use Data::Dumper 'Dumper'; print Dumper $people; __END__
Tell us what you get.
I'm loving Data::Dumper more and more. Apparently, it doesn't return a ref to an array of hashrefs like I figured it would. It it an array of array refs. I only requested one field from the DB so it is $people->[$lv]->[0].
-- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>