|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Displaying Recordsets in multiple rows and columns in CF
Hi there,
I'm trying to display ecommerce product photos horizontally across a page with multiple rows. To be more precise, I'd like to display my products in a 5 by 5 table displaying 25 database rows per page. Then, if there are more than 25 database rows output, the subsequent results would then flow onto subsequent pages. Is there a quick way to achieve this? I cannot find anything on the net that answers this question. Would much appreciate any help that anyone can offer. Regards Moo ![]() |
|
#2
|
|||
|
|||
|
You're really asking two questions. The easiest way to output a 5 column table is to use the MOD operator. Mod returns the remainder of the division of two numbers so you can use that to test what column is being rendered. Here's one for three columns:
<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> The other question you ask is about paged recordsets. There are many ways to do this, a Google search for "ColdFusion next n records" showed a bunch, including this.
__________________
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 |
|
#3
|
|||
|
|||
|
Thanks very much for your help. I'll give this a go.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Displaying Recordsets in multiple rows and columns in CF |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|