shawntbanks
Programmer
Hi there. I am trying to get a recordcount on how many vehicle ads are in a database. I am getting it for each individual subcategory, but not as a whole. could some give me a hand
<cfset Now_date = #dateformat (now(), "yyyy-mm-dd"
# >
<cfquery datasource="market" name="get_Vehicles">
select Category, subcategory, picture, subcategoryid
from subandcat
Where subcategoryid between 1 and 11
</cfquery>
<cfset subcat= arraynew(2)>
<cfset subcatid= arraynew(2)>
<cfloop from="1" to="11" index="i">
<cfquery datasource="market" name="sub">
select subcategory, subcategoryid, begindate, enddate
from adds
Where subcategoryid = '#i#' and (#CreateODBCDate(Now_date)# between begindate and enddate)
group by subcategory, subcategoryid, begindate, enddate
</cfquery>
<cfset subcat [1]= #sub.subcategory#>
<cfset subcat [2]= #sub.recordcount#>
<cfset subcatid [2]= #sub.subcategoryid#>
</cfloop>
<body>
<table width="800" border="0">
<tr>
<td width="255" valign="bottom"><font color="#669933" size="4" face="Verdana, Arial, Helvetica, sans-serif">
This is the out put where I want the total
<strong> <cfoutput>#get_Vehicles.Category#... (#sub.recordcount# listings) </cfoutput></strong></font></td>
<td width="535" align="right"><cfoutput query="get_Vehicles"><img src="images/#picture#"></cfoutput></td>
</tr>
<tr><td><BR><table border="0"><cfloop index="ip" from="1"to="11"><cfoutput><tr>
<td><strong><font size="+1"><a href="vehicledisplay.cfm?id=#subcatid[ip][2]#">#subcat[ip][1]#</a></font></strong>
<cfif #subcat [ip][2]# NEQ 0>
<font size="-1" face="Georgia, Times New Roman, Times, serif">(#subcat[ip][2]#)</font>
</cfif><abort></td></tr></cfoutput> </cfloop></table></td></tr>
</table>
<cfset Now_date = #dateformat (now(), "yyyy-mm-dd"
<cfquery datasource="market" name="get_Vehicles">
select Category, subcategory, picture, subcategoryid
from subandcat
Where subcategoryid between 1 and 11
</cfquery>
<cfset subcat= arraynew(2)>
<cfset subcatid= arraynew(2)>
<cfloop from="1" to="11" index="i">
<cfquery datasource="market" name="sub">
select subcategory, subcategoryid, begindate, enddate
from adds
Where subcategoryid = '#i#' and (#CreateODBCDate(Now_date)# between begindate and enddate)
group by subcategory, subcategoryid, begindate, enddate
</cfquery>
<cfset subcat [1]= #sub.subcategory#>
<cfset subcat [2]= #sub.recordcount#>
<cfset subcatid [2]= #sub.subcategoryid#>
</cfloop>
<body>
<table width="800" border="0">
<tr>
<td width="255" valign="bottom"><font color="#669933" size="4" face="Verdana, Arial, Helvetica, sans-serif">
This is the out put where I want the total
<strong> <cfoutput>#get_Vehicles.Category#... (#sub.recordcount# listings) </cfoutput></strong></font></td>
<td width="535" align="right"><cfoutput query="get_Vehicles"><img src="images/#picture#"></cfoutput></td>
</tr>
<tr><td><BR><table border="0"><cfloop index="ip" from="1"to="11"><cfoutput><tr>
<td><strong><font size="+1"><a href="vehicledisplay.cfm?id=#subcatid[ip][2]#">#subcat[ip][1]#</a></font></strong>
<cfif #subcat [ip][2]# NEQ 0>
<font size="-1" face="Georgia, Times New Roman, Times, serif">(#subcat[ip][2]#)</font>
</cfif><abort></td></tr></cfoutput> </cfloop></table></td></tr>
</table>