Hello all. I have a bit of a problem and am still searching for an answer on the net and thought this is a good place to ask too...
I am trying to extract from our sales table information and put it into a table to display (as usual) and am having a difficult time. Below is the code I am using.
Code:
<h3>Sales Statistics by Country</h3>
<cfparam name="i" default=0>
<cfquery name="rate" datasource="#request.dsn#">
select rate from rate;
</cfquery>
<cfquery name="sales_can" datasource="#request.dsn#">
select sum(total - pst - gst - hst - shipping_price) as total, sale_date, count(sales_id) as num, currency_id from sales where currency_id = 1 and od_archive = 'no' and franchise_id = 0 and wholesale = #request.dbfalse# group by currency_id;
</cfquery>
<cfloop query="sales_can">
<cfset Currency = year(currency_id)>
<cfset Sales = num>
<cfset Totals = total>
<cfset Years = sale_date>
</cfloop>
<table border="0" cellpadding="3" cellspacing="0" width="100%" class="mytable">
<tr>
<th align="center">#</th>
<th align="center">Currency</th>
<th align="center"># of Sales</th>
<th align="center">Dollar Total</th>
<th align="center">Years</th>
</tr>
<cfloop from=1 to=20 index="i">
<tr bgcolor="#EEF7FF">
<td align="center">#i#<cfset i eq (i + 1)></td>
<td align="center">#Currency#</td>
<td align="center">#Sales#</td>
<td align="center">#Totals#</td>
<td align="center">#Years#</td>
</tr>
</cfloop>
</table>
Im getting a table that is just displaying for each row the titles of each row, all enclosed between number signs (#). In other words the data is either not being extracted properly from the database or I have written something wrong and it's not displaying right.
If anyone can take a peek at my code and hopefully see the problem that would be great. I thank everyone for their time.
Cheers.