Page 2 of 2 First 12
  • Jump to page:
    #16
  1. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,261
    Rep Power
    1810
    Give us a hint. What was expected, what happened? Were there error messages?

    I did notice that even though all results were fetched in this line:

    Code:
    my $employees = $sth->fetchall_arrayref({});
    you attempted to fetch again:

    Code:
    while ( my @row = $sth->fetchrow_array( ) ) {
       print $csv->print($FILE, \@row);
    }
    If the first fetch is working (that's what Data::Dumper is for), then just use those results by looping over the array.
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    833
    Rep Power
    496
    From the DBI module documentation:

    The fetchall_arrayref method can be used to fetch all the data to be returned from a prepared and executed statement handle. It returns a reference to an array that contains one reference per row.
    Thus, when you do this:

    Perl Code:
    my $employees = $sth->fetchall_arrayref({});


    $employee is now a ref to an array containing references to all of your data rows.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo