Perobl has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks!
I am trying to process a MySQL query and send the results to the browser using Template Toolkit. It is my understanding that TT2 will only handle lists and hashes. I have opted to use a hash.
My query requires that I pass several records of data to the browser. I am trying to loop fetchrow_array() to to process each record to see if there is a match (my query includes a filtered search). If there is a match, I need to retrieve several columns of data from that record. So I have multiple pieces of data and multiple records to deal with.
Normally, I would format and print these results to the browser as part of the query. However, TT2 requires me to send this information to the browser via a template (as I'm sure you know). So it seems like I have to build a hash. I can write code to do this using all the scalar data, but I'm wondering if there is an easier (preferred) way to process this query. Seems like a lot of work (especially when TT2 makes so many other things so easy to do). Did I mention I have little experience using TT2?
What is the best way to do this?
Thanks for your time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best way to send records to the browser?
by Your Mother (Archbishop) on Jun 26, 2010 at 05:10 UTC | |
by Perobl (Beadle) on Jun 26, 2010 at 15:18 UTC | |
by Your Mother (Archbishop) on Jun 26, 2010 at 16:17 UTC | |
by Perobl (Beadle) on Jun 26, 2010 at 17:26 UTC | |
by almut (Canon) on Jun 26, 2010 at 17:51 UTC | |
| |
by Your Mother (Archbishop) on Jun 26, 2010 at 20:33 UTC | |
|