View Full Version : Display in 2 columns - ColdFusion

12-07-2002, 04:34 PM
I have a form that allows the user to select from several options, and when submitted takes them to another page to display the results based on those choices. The number of results could be any where from 1 to 20 or more, and I would like to display the results in 2 columns.

What is the best way to do this? I know there is something to do with <cfset x=0> and a <cfif x mod 2 is 1> , but I'm missing vital pieces of the code and don't know what they are!

Any other suggestions on how to do this?

Any help would be much appreciated!

12-20-2002, 10:10 AM
<cfset counter=1>
<cfloop query="results">


<cfif counter MOD 2 is 0>

<cfset counter=counter+1>


Try that, I never usually get these right first time tho so u might wanna play around with it if it dont work.

12-20-2002, 03:17 PM
Thank you very much for helping, but I've already figured it out, Your method is almost the same as what I'm using. Here is my basic code, if anybody cares!

<CFSET x=0>
<cfoutput query="stuff">
<cfset x = x+1>
<cfif x mod 2 is 1>
<td>Column 1 results</td>

<td>Column 2 results</td>

Thanks again. I'll try to be better about posting code once I get a solution, maybe then somebody else can benefit from my ignorance!
Happy Holidays to all you coders out there - you know who you are.