Then how do I avoid such an occurance? 




> On Fri, 27 Sep 2002, Kenny Pyatt wrote:
> 
> >      # Build the tmpl_loop data structure and load the template
> >      while (my $data = $sth->fetchrow_hashref())
> >      {
> >          push (@loopData, $data);
> >      }
> >      # Give the data to the template
> >      $template->param('MyLoop' => \@loopData);
> 
> 
> Instead of this:
> 
>         push (@loopData, $data);
> 
> You may want to do this instead:
> 
> push (@loopDate, \%{$data});
> 
> Which creates a copy of the hash and passes its rerference instead.
> From the DBI perldoc:
> 
>            Currently, a new hash reference is returned for each
>            row.  This will change in the future to return the
>            same hash ref each time, so don't rely on the current
>            behaviour.
> 
> Which if you use the code at the top, and then the above takes effect,
> every row would have a reference to the last row's data.
> 
> --Alex
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Html-template-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/html-template-users



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to