[Templates] MySQL Quriry Question.

[prev] [thread] [next] [Date index for 2004/10/04]

From: Shanta McBain
Subject: [Templates] MySQL Quriry Question.
Date: 17:21 on 04 Oct 2004
Hi

I am attempting to create a html table of entries from a log table.

The output table will look like
Date Description project 1 project 2 project 3 .... Total time for the day.

Data is stored in the table
Date project name description time

My code looks so far like this. The script fails on passing the date gotten 
from the first query into the second.	
                                WHERE  (project_code = 'ECF_Bill_HH_WO' AND
	                                        startdate = log.start_date) # this 
fails How do I pass the date value from the first query to the second?


[% FOREACH log = DBI.query("SELECT * FROM csc_log_tb
                                   WHERE start_date LIKE '2003-10%'
                                   AND (project_code = 'ECF_Bill_HH_WO' OR
                                            project_code = 'ECF_BeeWork_Bill' 
OR
                                        project_code = 
'ECF_Bill_Maintinance_Equipment' OR
                                        project_code = 'ECF_Pollination_Bill' 
OR
                                        project_code = 
'ECF_Bill_Property_Matinance')
                                   ORDER BY start_date 
                           ")%]    
                        <tr>
   <td>[% log.start_date %]</td>

[% total_day_time = 0 %]
	[% FOREACH item = DBI.query("SELECT * FROM csc_log_tb
	                                WHERE  (project_code = 'ECF_Bill_HH_WO' AND
	                                        startdate = log.start_date)
	                            ")%]    
	    [% total_item_time = total_item_time + item.time %]
	                                 
	    [% total_day_time = total_day_time + total_item_time %]
	 
	   [% END %]
	    
	   <td>[% total_item_time %]</td>
	   
	    [% total_time = total_time + total_day_time %]
  <td>[% total_day_time %]</td>
   </tr>
   [% END %]

Shanta McBain
http://computersystemconsulting.ca




        -- 
        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

[Templates] MySQL Quriry Question.
Shanta McBain 17:21 on 04 Oct 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52