Re: multiple fields from SQL query --Update
Mark Haney <markh-rOuQeLG7NUhWk0Htik3J/[email protected]> Tue, 29 May 2012 11:20:00 -0400
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <[email protected]> |
On 05/24/2012 02:53 PM, Theunis De Klerk wrote:
>
> Hi Mark,
>
> I am not sure I understand exactly what you are trying to achieve, but I
> think you are right about putting it into a scalar.
>
> As an example, how does this work for you :
>
> my @rows_factory;
> while ( my @factory_data = $sth->fetchrow_array() )
> {
> push @rows_factory, {'id' => $factory_data[0], 'abbr' => $factory_data[1]};
> }
>
> I normally do that when I want to do this in the template :
>
> <select name="factory">
> [% FOREACH factory IN factories %]
> <option value="[% factory.id %]" size="20">[% factory.abbr %]</option>
> [% END %]
> </select>
Sorry it took so long to reply. Took a long Memorial Day holiday. My
Father in law was recognized by the State of NC for being the most
decorated soldier to come out of WNC and had a special ceremony for him.
Even though he passed away in 1997, the entire family was there to
celebrate.
As for the code, I do believe this will work, and I'll check it later today.
--
Mark Haney
Software Developer/Consultant
AB Emblem
markh-rOuQeLG7NUhWk0Htik3J/[email protected]
Linux marius.homelinux 3.3.6-3.fc16.x86_64 GNU/Linux