ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 16th, 2005, 08:14 AM
bloodfest bloodfest is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 11 bloodfest User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 53 m 12 sec
Reputation Power: 0
Exclamation data placement...

I need to display the results a query 3 columns across then drop down to the next row and display the rest of the info and so on...

#1 #2 #3
#4 #5 #6
#7.................... and so on...

here's the code I'm trying to use.. It kinda works... I can't display the last record.

<cfset i = 1>
<cfloop query="FAVORITES" startrow="#i#" endrow="#i+1#">
<cfoutput>
<tr>
<td><img src="images/artists/#FAVORITESPHOTO[i]#" width="65"></td>
<td><font color="CC6600"><b>#FAVORITESARTIST[i]#</b></font><br>#FAVORITESLOCATION[i]#</td>
<td><img src="images/artists/#FAVORITESPHOTO[i+1]#" width="65"></td>
<td><font color="CC6600"><b>#FAVORITESARTIST[i+1]#</b></font><br>#FAVORITESLOCATION[i+1]#</td>
<td><img src="images/artists/#FAVORITESPHOTO[i+2]#" width="65"></td>
<td><font color="CC6600"><b>#FAVORITESARTIST[i+2]#</b></font><br>#FAVORITESLOCATION[i+2]#</td>
<cfset i = i+3>
</cfoutput>
</cfloop>

bloodfest

Reply With Quote
  #2  
Old September 16th, 2005, 08:35 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 42 m 54 sec
Reputation Power: 53
Here is a simple example that uses the modulus operator, which returns the remainder of the first value divided by the second. When the remainder is 1 you know you're at the start of the row, and when the remainder is 0 you know you're at the end of the row.

<cfoutput>
<table border="1">
<cfloop index="i" from="1" to="12">
<cfif i mod 3 eq 1>
<tr>
</cfif>
<td>#i# - #i mod 3#</td>
<cfif i mod 3 eq 0>
</tr>
</cfif>
</cfloop>
</table>
</cfoutput>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old September 16th, 2005, 08:47 AM
bloodfest bloodfest is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 11 bloodfest User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 53 m 12 sec
Reputation Power: 0
Almost...

<cfoutput>
<table border="1">
<cfloop index="i" from="1" to="12">
<cfif i mod 3 eq 1>
<tr>
</cfif>
<td>#FAVORITESARTIST[i]#</td>
<cfif i mod 3 eq 0>
</tr>
</cfif>
</cfloop>
</table>
</cfoutput>

I tried this but it repeat the query 8 times... so I got all the records.. 8 times..

Reply With Quote
  #4  
Old September 19th, 2005, 09:00 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 42 m 54 sec
Reputation Power: 53
Is "favoriteartist" a query? If so, why not just use the normal query syntax ie "myqueryname.mycolumnname"?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > data placement...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT