Re: [Templates] hashes and loops

[prev] [thread] [next] [Date index for 2004/10/21]

From: Michael
Subject: Re: [Templates] hashes and loops
Date: 13:58 on 21 Oct 2004
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
>> templates@xxxxxxxxxxxxxxxx.xxx
>> http://lists.template-toolkit.org/mailman/listinfo/templates
> 
> 

        -- 
        Michael Peters
Developer
Plus Three, LP


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

(message missing)

[Templates] hashes and loops
Brandon Hall 19:03 on 19 Oct 2004

Re: [Templates] hashes and loops
Sean Kellogg 19:10 on 19 Oct 2004

Re: [Templates] hashes and loops
Brandon Hall 06:51 on 21 Oct 2004

Re: [Templates] hashes and loops
Michael 13:44 on 21 Oct 2004

Re: [Templates] hashes and loops
Michael 13:58 on 21 Oct 2004

Re: [Templates] hashes and loops
Dave Cash 13:47 on 21 Oct 2004

Re: [Templates] hashes and loops
Sean McAfee 14:34 on 21 Oct 2004

Re: [Templates] hashes and loops
Trond Michelsen 14:44 on 21 Oct 2004

Re: [Templates] hashes and loops
Mark Mills 15:22 on 21 Oct 2004

Re: [Templates] hashes and loops
Darren Chamberlain 19:13 on 19 Oct 2004

Re: [Templates] hashes and loops
Simon Wistow 20:54 on 19 Oct 2004

Re: [Templates] hashes and loops
Brandon Hall 23:56 on 21 Oct 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52