title: Coldfusion - variable field name when looping through database query results
body: <p>I have a set of column names in a table - e.g. foo1, foo2, foo3, foo4. I want to refer to these column names dynamically through a loop:</p>
  
  <pre><code>&lt;cfloop index="i" from="1" to="4"&gt;
    &lt;cfset foo = Evaluate("query.foo" &amp; i)&gt;
  &lt;/cfloop&gt;
  </code></pre>
  
  <p>The above doesn't work - ColdFusion throws a "variable not defined" error, even though <strong>query.foo1</strong> is a valid reference to the query results. How else can I do this?</p>