On Sun, 31 Mar 2002, Aranya Ghatak wrote:

> my @loop;  # the loop data will be put in here
> 
>   $passedquery = "select id, lname, fname, email from member";
>   $sth = $dbh->prepare($passedquery) || die $dbh->errstr;
>   $sth->execute || die $dbh->errstr;
> 
>   my $names = $sth->{'NAME'};
>   my $numFields = $sth->{'NUM_OF_FIELDS'};
>   open (FH, ">debug.txt");
>   while ($ref = $sth->fetchrow_arrayref) {

my %row;

>        for (my $i = 0;  $i < $numFields;  $i++) {
>           $row{$$names[$i]} = $$ref[$i];
>        }
>        while (($k, $v) = each %row) {print FH "$k=>$v\t"};
>        print FH "\n";
>        push(@loop, \%row);
>   }
>   close(FH);
> # call param to fill in the loop with the loop data by reference.
> $template->param(passed_loop => \@loop);

you're pushing a reference to the same hash after every loop.  And 
you're overwriting that hash every pass through the loop.  You need to 
declare the has everytime.

Let me guess, you didn't use the -w switch or use strict

-- 
"Maintain an awareness for contribution -- to your schedule, your project, 
our company."  
-- A Group of Employees


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

Reply via email to