4 Replies Latest reply on Jan 28, 2007 1:34 PM by namtax

    cfloop displaying duplicate values

    namtax Level 1
      hi
      i am using a cfloop to output a query for my forum topics

      <cfloop query="emex" startrow="#url.startrow#" endrow="#endrow#">
      <cfoutput>
      (forum list)
      <cfloop>
      <cfoutput>

      however, as i cant use the group attribute of the cfoutput here, i am getting duplicate values in my forum list...is there anyway around this...

      thanks
        • 1. Re: cfloop displaying duplicate values
          Dan Bracuk Level 5
          Don't use cfloop. Use the query attribute of cfoutput instead.
          • 2. Re: cfloop displaying duplicate values
            namtax Level 1
            its just that the way i have learnt to do next n records system in ben fortas book uses cfsets that are then called in the cfloop....so,


            <!---number of rows to display per next/back page--->
            <cfset rowsPerPage =10>

            <!---what row to start at? Assume first by default--->
            <cfparam name="URL.startRow" default="1" type="numeric">

            <!---we know the total number of rows from query--->
            <cfset totalRows = song_mess.recordCount>

            <!---Last row is 10 rows past the starting row, or--->
            <!---total number of rows, whichever is less--->
            <cfset endRow = min(URL.startRow + rowsPerPage - 1, totalRows)>

            <!---Next button goes to 1 past current end row--->
            <cfset startRowNext = endRow + 1>

            <!---Back button goes back N rows from start row--->
            <cfset startRowBack = URL.startRow - rowsPerPage>

            is then called on in the cfloop.....

            <cfloop query="emex" startrow="#url.startrow#" endrow="#endrow#">
            <cfoutput>
            (forum list)
            <cfloop>
            <cfoutput>

            if I use the query attribute of cfoutput instead the nextnrecords doesnt work...
            • 3. Re: cfloop displaying duplicate values
              Level 7
              > <cfloop query="emex" startrow="#url.startrow#" endrow="#endrow#">
              > <cfoutput>
              > (forum list)
              > <cfloop>
              > <cfoutput>

              I presume the latter two are supposed to be *closing* tags? If so, your
              tags are illegally nested. I'm surprised this does not simply error, to be
              honest.

              If not, I think you need to post more code.

              --
              Adam
              • 4. Re: cfloop displaying duplicate values
                namtax Level 1
                sorry its meant to be

                > <cfloop query="emex" startrow="#url.startrow#" endrow="#endrow#">
                > <cfoutput>
                > (forum list)
                > </cfoutput>
                </cfloop>

                i think the solution to the issue, is as dan says, to not use the cfloop.......