4 Replies Latest reply on Feb 8, 2007 11:38 AM by brianism

    another loop question

    brianism Level 1
      Can anyone tell me what I'm doing wrong? I'm trying to loop through my recordcount of a query to create multiple <divs> that another piece of code will rotate. That seems to be working fine, but I can't figure out how to get different info from my query statment into each one of those <divs> It picks up the first record in my query and repeats it. Here is the code I'm using.

      <cfquery name="qfeatured" datasource="mydb">
      SELECT * FROM Places WHERE featured = 'yes' ORDER BY establishment
      </cfquery>


      <cfoutput query="qfeatured">
      <cfif establishment_type EQ "Restaurant" OR establishment_type EQ "Bar/Restaurant">


      <cfloop from="0" to="#qfeatured.recordcount#" index="i">
      <div id="dropmsg#i#" class="dropcontent" subject="">

      <table cellspacing="3" cellpadding="3" width="100%">
      <tr>
      <td bgcolor="##3D5285" valign="top">#i# - #establishment#</td>
      </tr>
      </table>

      </div>
      </cfloop>
      </cfif>
      </cfoutput>

      These returns the results as:

      0 - My Establishment Name
      1 - My Establishment Name
      2 - My Establishment Name

      What I am trying to make it do is:

      0 - My First Establishment Name
      1 - My Second Establishment Name
      2 - My Third Establishment Name