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

  1. #1

    Default cfloop error

    I am getting an error that is resolving to the closing tag for the </cfloop>.
    Any Ideas?

    <cfoutput query="Recordset1" group="category">
    <table cellpadding="2" cellspacing="0" border="1">
    <tr>
    <cfloop query="PictureURL">
    <cfif NOT CurrentRow Mod 2>
    <td><img src="#PictureURL#"
    alt="undefined.#PictureURL#"><br>#caption#</td></tr>
    <cfif CurrentRow NEQ RecordCount><tr></cfif>
    <cfelse>
    <td><img src="#PictureURL#" alt="undefined.#PictureURL#"><br>#caption#</td>
    <cfif CurrentRow EQ RecordCount>
    <cfif CurrentRow Mod 1>
    <td>&nbsp;</td><td>&nbsp;</td>
    <cfelse>
    <td>&nbsp;</td>
    </cfif>
    </tr>
    </cfif>
    </cfif>
    </cfloop>
    </table>
    </cfoutput>

    brokerandy25 Guest

  2. Similar Questions and Discussions

    1. cfloop
      The goal is to insert a record into table 'atd', which contains a document id and an associate id, for each document (38) and associate (150). So...
    2. Attribute validation error for tag cfloop
      I am trying to dynamically generate a "photo album" output into a table with corresponding captions: The out put should be 1 2 1.c 2.c...
    3. Cfloop..
      I am trying to loop over a list: <cfquery name="updsyllabus" datasource="#arguments.syl.dsn#"> UPDATE #arguments.syl.tname# SET <cfloop...
    4. CFLOOP out of memory error
      I am looping through a huge query, upto 800K records to do a bunch of calculations. Basically, comparing dates, adding dates, and counting...
    5. CFLOOP Error?
      I keep getting an error that says that I need to have a CFLOOP end tag? The bolded line is where Coldfusion says the error is occurring: <cfquery...
  3. #2

    Default Re: cfloop error

    oops old code . . . . the 4th line is correct it does read <cfloop query="Recordset1>
    brokerandy25 Guest

  4. #3

    Default Re: cfloop error

    can you post the error.
    JJBBDD Guest

  5. #4

    Default Re: cfloop error

    THe CF server is telling me that there is a "Attribute validation error for tag
    cfloop at line 166". line 166 resolves to </cfloop> and that is all that is on
    that line.

    I am way confused.

    THanks for the help

    andy
    [url]http://www.indianaevenings.com[/url]

    brokerandy25 Guest

  6. #5

    Default Re: cfloop error

    I think the error is actually in your initial CFLOOP tag. Why are you using
    CFOUTPUT on your query, then using CFLOOP on the same query? If you want to
    group by category in your initial CFOUTPUT tag, you use CFOUTPUT by itself to
    then loop through each record inside the group.

    At any rate, I think the error is caused by a conflict using CFOUTPUT and
    CFLOOP on the same query.

    -Paul


    dempster Guest

  7. #6

    Default Re: cfloop error

    Still confused - maybe I am trying to go about this all wrong, I am trying to
    pull info from a data base (duh) and I need to output the info like this

    1 2
    1.c 2.c
    3 4
    3.c 4.c ETC. . ..

    1, 2, 3, 4, are photos, which img src tag is dynamically generated from an
    address that is stored in a database
    and the 1.c, 2.c are captions that correspond to those images. I need to
    output them in rows, with only 2 pictures per row, but I will not know how many
    pictures there are.

    If I try messing with the cfloop or cfoutput, then the pictures don't show in
    Opera 7, and nothing will show in IE which is what this code needs to be
    compatibal with. THIS problem, has seriously caused a major headache.

    I thank you for your time.

    Andy



    brokerandy25 Guest

  8. #7

    Default Re: cfloop error

    So where does the group by category come from? Are you creating a different
    table for each category?

    If so, you can group your output by category and then use CFOUPUT to get each
    image. You can't test for current row as odd or even because this will change
    for each category. Just use a simple variable to keep track of which column you
    are in and keep switching it for each record. The attached code should
    demonstrate.

    -Paul



    <cfoutput query="Recordset1" group="category">
    <h2>#category#</h2>
    <table cellpadding="2" cellspacing="0" border="1">
    <cfset col = 1><tr>
    <cfoutput>
    <td><img src="#PictureURL#" alt="#caption#"><br>#caption#</td>
    <cfif col IS 2></tr><cfset col = 1><cfelse><cfset col = 2></cfif>
    </cfoutput>
    <cfif col IS 2><td>&nbsp;</td></tr></cfif>
    </table>
    </cfoutput>

    dempster 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