growlf has asked for the wisdom of the Perl Monks concerning the following question:
I have read the POD on HTML::Template several times now, and the POD on DBI/DBD::MySQL in the attempt to use the fetchall_arrayref() method from the DBI to feed a template loop. Is this indeed possible - or do I actually have to manually loop through the 30 or more records to build the array reference of hash references that Template loop is wanting?
example of what i THINK the DBD is returning (and appearantly is NOT working with Template):
my @loop_data=(); $loop_data=[ {Auction=>'Test1', ID=>'1'}, {Auction=>'Test2', ID=>'2'}, {Auction=>'Test3', ID=>'3'}, {Auction=>'Test4', ID=>'4'}, ]; $template->param(table1 => \@loop_data);
the same code DOES work with:
my @loop_data=(); my %rowdat; $rowdat{Auction}='Test1'; $rowdat{ID}='1'; push(@loop_data, \%rowdat); $template->param(table1 => \@loop_data);
Or the iterative version thereof. What obvious thing am I missing - or is it just not possible and I am beating my head on a stone wall?
Thanks in advance for any help on this, my first posting.
Edit - Petruchio Sat Oct 20 02:36:36 UTC 2001: Added markup
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: By ref or by ..well..ref!
by Zaxo (Archbishop) on Oct 20, 2001 at 06:44 UTC | |
|
Re: By ref or by ..well..ref!
by footpad (Abbot) on Oct 20, 2001 at 06:50 UTC | |
by growlf (Pilgrim) on Oct 20, 2001 at 11:39 UTC | |
by tilly (Archbishop) on Oct 20, 2001 at 17:27 UTC | |
by uwevoelker (Pilgrim) on Oct 20, 2001 at 14:12 UTC |