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
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to