Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array Recordcount total

Status
Not open for further replies.

shawntbanks

Programmer
Oct 29, 2003
48
CA
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(), &quot;yyyy-mm-dd&quot;)# >

<cfquery datasource=&quot;market&quot; name=&quot;get_Vehicles&quot;>
select Category, subcategory, picture, subcategoryid
from subandcat
Where subcategoryid between 1 and 11
</cfquery>

<cfset subcat= arraynew(2)>
<cfset subcatid= arraynew(2)>

<cfloop from=&quot;1&quot; to=&quot;11&quot; index=&quot;i&quot;>
<cfquery datasource=&quot;market&quot; name=&quot;sub&quot;>
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=&quot;800&quot; border=&quot;0&quot;>
<tr>
<td width=&quot;255&quot; valign=&quot;bottom&quot;><font color=&quot;#669933&quot; size=&quot;4&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;>
This is the out put where I want the total
<strong> <cfoutput>#get_Vehicles.Category#... (#sub.recordcount# listings) </cfoutput></strong></font></td>
<td width=&quot;535&quot; align=&quot;right&quot;><cfoutput query=&quot;get_Vehicles&quot;><img src=&quot;images/#picture#&quot;></cfoutput></td>
</tr>
<tr><td><BR><table border=&quot;0&quot;><cfloop index=&quot;ip&quot; from=&quot;1&quot;to=&quot;11&quot;><cfoutput><tr>
<td><strong><font size=&quot;+1&quot;><a href=&quot;vehicledisplay.cfm?id=#subcatid[ip][2]#&quot;>#subcat[ip][1]#</a></font></strong>
<cfif #subcat [ip][2]# NEQ 0>
<font size=&quot;-1&quot; face=&quot;Georgia, Times New Roman, Times, serif&quot;>(#subcat[ip][2]#)</font>
</cfif><abort></td></tr></cfoutput> </cfloop></table></td></tr>
</table>
 
I dont use cf but something along the lines of

Code:
<cfset subcat [1]= #sub.subcategory#>
<cfset subcat [2]= #sub.recordcount#> 

<cfset subcatid [2]= #sub.subcategoryid#>   
<cfset adTotal = adTotal + #sub.recordcount#> 
</cfloop>

You will have to check the format

Cheech

[Peace][Pipe]
If you don't stand up for something, you'll fall down. Toke it Easy.
Howard Marks. Visit the forum at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top