On Thursday 20 January 2005 02:39 am, Simon Matthews wrote:
> The problem is that you are not naming your DBI queries and the content of
> the DBI object is getting mangled by you calling it again.
>
> There are two solutions to this:
>
> 1. Create more than one DBI object like so....
>
>
> [% USE q1 = DBI(.....) %]
> [% USE q2 = DBI(.....) %]
>
> Which is my preferred approach because some DBI connections do not allow
> you to have more than one result set open at any one time.
>
> More on this in:
> http://www.template-toolkit.org/docs/plain/Modules/Template/Plugin/DBI.html
> look for Using Named DBI connections.

 Thanks. This one works. 

> 2. As you are using mysql you can actually get away with having more than
> one result set open so you can do something like this:
>
> [% USE DBI(....) %]
> [% results1 = DBI.query("the sql for your outer query") %]
>
> [% FOREACH result = results %]
>       [% FOREACH inner = DBI.query("your inner sql") %]
>
>       [% END %]
> [% END %]
>
>
If I am reading this right I am populating a result set into results1  Then 
using them in a different set of conditional statements that only contain one  
quire.

Should the first [% FOREACH result = results %] read [% FOREACH result = 
results1 %]
 
> You can find examples of this in t/dbi.t in the Template Toolkit
> distribution

I will find them and have a look.


-- 
Thanks
Shanta McBain
Http://computersystemconsulting.ca Web hosting and Application Hosting.

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to