As mentioned by CountZero above, you can’t nest TT that way. This should do what you want but I’m not sure it’s a good idea–
[% FOR row IN rows %] [% query_str = "SELECT * FROM contacts WHERE account_code = ${row.acco +unt_code}" %] [% END %]
Getting this kind of thing out of the templates will be a long run win. If you prefer to do things this way, PHP is probably just as good, if not better, for this style of in-template code. (I prefer Perl.)
Update, as is, that code does nothing really… just sets a variable. So I don’t know it will actually do what you want. :)
In reply to Re^3: How to use template toolkit variable in a template toolkit mysql query
by Your Mother
in thread How to use template toolkit variable in a template toolkit mysql query
by hamidafshar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |