in reply to Template::Toolkit, DBI and mysql % wildcards
Why don't you simply move the query out of the TT template?
my $dbh = DBI->connect( ... ); my $items = $dbh->selectall_arrayref(q{ select user from logs where user not like 'adm%' }, {Slice=>{}}); my $template = Template->new or die Template->error; $template->process(\*DATA, {items => $items}) or die $template->error; __DATA__ [% FOREACH item = items %] [% item.user %] [% END %]
UPDATE: I should have checked before posting, holli gave the same answer first. holli++
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Template::Toolkit, DBI and mysql % wildcards
by holli (Abbot) on Mar 14, 2006 at 21:07 UTC | |
|
Re^2: Template::Toolkit, DBI and mysql % wildcards
by bfdi533 (Friar) on Mar 14, 2006 at 21:13 UTC |