Hello,
I'm relatively new to TT2, and am enjoying working with it. Here's my question:


I'm trying to display "Month Year" (the next 18 months) in a select box, ie: <option value="November 2003"><option value="December 2003">...

So, I'm using dbi:mysql, and I thought I'd just use mysql's date functions to get the strings I need like this:

[% TRY %]
[% count=0 %]
[% WHILE count < 18 %]
[% FOREACH monthname = DBI.query('SELECT DATE_FORMAT(NOW() + INTERVAL $count month, \'%M %Y\') as thismonth') %]
[% monthname.thismonth %]
[% END %]
[% count=count+1 %]
[% END %]
[% CATCH DBI %] Ooops! A database error occurred: [% error.info %]
[% END %]


But... $count isn't being interpolated before the query is run...
Any way around this? What am I missing?

When I replace $count with an integer, it works fine - except of course all 18 months are the SAME. :-(

Thanks,
Ken A.

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

Reply via email to