in reply to loop though query results twice

pdmonney:

If your datasets aren't too large, you might try using fetchall_array instead of fetchrow_array to get the entire dataset. Then you can iterate over the array as many times as you like without having to talk with the database.

...roboticus

Replies are listed 'Best First'.
Re^2: loop though query results twice
by pdmonney (Initiate) on Apr 28, 2009 at 12:39 UTC
    I looked online and I am having trouble understanding the fetchall_array command, and how it works, can you use it in the example I gave?
      my $tbl_ary_ref = $query1->fetchall_arrayref; warn "WHOOPS ", $query1->err if $query1->err ; for my $data ( @{ $tbl_ary_ref } ){ my $cur_company = $$data[0]; $cur_company = $data->[0]; ... } for my $data ( @{ $tbl_ary_ref } ){ my $cur_company = $$data[0]; $cur_company = $data->[0]; ... } for my $data ( @{ $tbl_ary_ref } ){ my $cur_company = $$data[0]; $cur_company = $data->[0]; ... }
      references quick reference