Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Sarasota, FL, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display in 2 columns - ColdFusion

    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!
    "It takes a big man to cry, but it takes a bigger man to laugh at that man." Jack Handy

  • #2
    New Coder
    Join Date
    Jul 2002
    Location
    Adelaide, Australia
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <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.

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    Sarasota, FL, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    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.
    "It takes a big man to cry, but it takes a bigger man to laugh at that man." Jack Handy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •