[Templates] MySQL Question
[prev]
[thread]
[next]
[Date index for 2004/11/10]
Hi
I am parsing a table for a value and using that value to search another table.
How do I pass a variable to a TTML Version of a MySQL search?
Here is what I am using. (I have put comments in the code.)
[% FOREACH item = DBI.query("SELECT * FROM altpower_inventory_tb
WHERE (comments LIKE '%Battery%'
)
")%]
<tr>
<td >[% item.name %]</td>
<td >[% item.volts %]</td>
<td >[% item.amps %]</td>
<!---Here I put the value of the field into a variable.-->
[% item_code = item.item_code %]
<!--- Here is the problem -->
[% FOREACH logentry = DBI.query("SELECT * FROM altpower_battery_log_tb
WHERE (project_code = "[% item_code %]"
<!--- The above code reports the fallowing TTML error.
file error - parse error: StatsView.ttml line 47-48: unexpected token (%)
[% FOREACH logentry = DBI.query("SELECT * FROM altpower_battery_log_tb
WHERE (project_code = "[% item_code
%]
-->
)
")%]
<td ">[% logentry.time %]</td>
</td>[% END %]
[% Voltage = logentry.time %]
<td >
--
Thanks
Shanta McBain
Http://computersystemconsulting.ca Web hosting and Application Hosting.
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
(message missing)
|
 |
 |
[Templates] MySQL Question
Shanta McBain 19:13 on 10 Nov 2004
|