Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Cfoutput help!!!

    I am trying to figure out how to output records from a query that is returing 2
    distinct table rows from each query. THe out put needs to look like this

    1 2
    1.a 2.a
    3 4
    3.a 4.a

    and so on. any ideas? I feel like all I am doing is just hacking at it. 1,
    2, 3, 4 are one table column, and 1.a, 2.a, 3,a, 4.a are a different column but
    same record. Make sense?

    brokerandy25 Guest

  2. Similar Questions and Discussions

    1. No row output if no cfoutput
      I've been trying to build a table in the following format: <tr><td>HTML</td> <CFOUTPUT...
    2. cfoutput and css
      I declare an entire document within a <cfoutput> </cfoutput> section. I am trying to insert the following css style descriptor into the code: ...
    3. cfoutput prblem
      Hi: I made a registration page with coldfusion, then I want the user to edit it's info. So I started the page with a cfquesry and then a cfoutput ...
    4. cfoutput and cfloop
      Hi all, well this is my question: I want to show 2 or more different sets of record sets but one or more of them have to be nested on the first,...
    5. <cfoutput>
      Hi. I'm trying to rename a file but I get an error message. My code looks someting like this: <cfset source='C:\MyDocs\old.doc'> <cfset...
  3. #2

    Default Re: Cfoutput help!!!

    There might be more elegant solutions than this, for sure, but here's something
    to get you started.

    <cfquery name="myQuery" datasource="mydatasource">
    SELECT column1,column2 FROM mytable
    </cfquery>

    <cfoutput>
    <cfloop query="myQuery">
    <cfif currentrow MOD 2 EQ 1>
    <!--- 1st, 3rd, 5th, 7th, etc. line of query --->
    <cfset temp1 = column1><cfset temp2 = column2>
    <cfelse>
    <!--- 2nd, 4th, 6th, 8th, etc. line of query --->
    #temp1# #column1#<br>
    #temp2# #column2#<br>
    <!---<cfset temp1 = ""><cfset temp2 = "">--->
    </cfif>
    </cfloop>
    </cfoutput>

    This example assumes there is an even number (2, 4, 6, 8...) rows returned. If
    you're expecing an odd number of records returned, uncomment the line I've
    commented, so that you can after the loop check if temp1 and temp2 were
    assigned something else than blank/empty, and flush #column1# and #column2#
    values on the screen. Or you can place some extra conditions inside the loop,
    checking if we're on the last line of the query, and the recordcount is an odd
    number (1, 3, 5, 7...), so it'll not buffer the values, but output them instead.


    Fernis Guest

  4. #3

    Default Re: Cfoutput help!!!

    I really appreaciate the help, but my problem is that I won't know how many
    records, for we are outputting a list of pictures for an "oniline photo album".
    people can already upload photos to the site. Any other Ideas, i Do really
    appreciate the help

    ANdrew WInn
    [url]http://www.indianaevenings.com[/url]

    brokerandy25 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139