Michael wrote:
Brandon Hall wrote:

On Tue, 19 Oct 2004 12:10:20 -0700, Sean Kellogg
That solved it magnificently! Now i'm trying to clean it up so I don't
have to specify the fields and I can cut and paste more code ...so. I
wrote this using what I've learned. This snip works, but I don't think
it's correct. I think there is a perl fudge making it work ;)

   while (my $rowref = $sth->fetchrow_hashref) {
       foreach (my $href = $rowref) {
           my %result = %{ $href };               push @notes, \%result;
       }
   }


this would be better written as...
    my $notes = $sth->fetchrow_arrayref({});


I meant... my $notes = $sth->fetchall_arrayref({});

sorry!

This will put each row as a hash ref inside of one array ref that you can then pass to your template. Much cleaner.


This way, in the template I can just use the database fields. eg, timestamp, id, param1, etc. --

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates



-- Michael Peters Developer Plus Three, LP


_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to