...

View Full Version : Display in 2 columns - ColdFusion



goodoyster
12-07-2002, 03: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!

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

<td><cfoutput>#result#</cfouput></td>

<cfif counter MOD 2 is 0>
</tr><tr>
</cfif>

<cfset counter=counter+1>

</cfloop>
</tr>
</table>


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

goodoyster
12-20-2002, 02: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>
<tr>
<td>Column 1 results</td>

<cfelse>
<td>Column 2 results</td>
</tr>
</cfif>
</cfoutput>

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum