Will,
Try your code using ORDER BY rather than GROUP BY in the query.
Dina
----- Original Message -----
From: W Luke
To: CF-Talk
Sent: Sunday, March 31, 2002 11:06 AM
Subject: Tricky grouping
Hi.
I'm having a bit of a nightmare with Grouping again. The code below
displays images in rows, left to right, 3 at a time. It's a template for
the rest of the site.
What I need to do is search a range of columns, and display images under
headings. EG:
Here are the results found in the description field:
Image 1, 2, 3 etc
Here are the results found in the title field:
Image 1, 2, 3 etc (or none at all..)
Here's the query:
<Cfquery name="latestphotos" datasource="#application.ds#">
SELECT ID,description,title,owner,album,thumb_user_path,
views FROM thumbnailelements
WHERE description like '%#url.rope#%'
OR title like '%#url.rope#%'
OR owner like '%#url.rope#%'
OR album like '%#url.rope#%'
GROUP by description,title,owner,album,ID,thumb_user_path,views
</cfquery>
I only really need to display results for the Album, Owner, Title and
Description. Here's the <cfoutput> code:
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<CFOUTPUT group="description" QUERY = "latestphotos">
<!--- Determine if this is record 1, 4, 7, etc...--->
<!--- If so, open the row. --->
<CFIF CurrentRow MOD 3 IS 1>
<tbody><TR>
</CFIF>
<TD class=dark vAlign=top width="32%">
<a href="#application.singlephoto#?pid=#id#"><IMG
class=imgborder src="#thumb_user_path#" border=0></a>
<BR><B>#title#</B> (#views#)<br>
#owner#
<p> </p>
</TD>
<TD width="1%"><IMG height=16 src="imagebin/spacer.gif"
width=16 border=0></TD>
<!--- Determine if this is record 3, 6, 9, etc... --->
<!--- If so, close the row. --->
<CFIF CurrentRow MOD 3 IS 0>
</TR></tbody>
</CFIF>
</CFOUTPUT>
<!--- If the query record count is not equally divisible by 3, --->
<!--- the last row was not close. --->
<!--- Determine how many more columns are needed, create them --->
<!--- and close the row. --->
<CFIF latestphotos.RecordCount MOD 3 IS NOT 0>
<CFSET ColsLeft = 3 - (latestphotos.RecordCount MOD 3)>
<CFLOOP FROM = "1" TO = "#ColsLeft#" INDEX = "i">
<TD> </TD>
</CFLOOP>
</TR></tbody>
</CFIF>
</table>
Sorry for the mammoth post - hope someone can advise.
Cheers
Will
__________________________________________________
Try Pingo:
http://www.localbounty.com/pingo
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists