Increment a variable?

Posted on 2004-09-17
Last Modified: 2013-12-24
I have a table thats 52 columns wide, I have 52 fields (w1-w52) that I need to display for each person, i need to do something like:

<cfset k1 = 0>
<cfoutput query="grp1" >
   <cfset k1 = k1 + 1>
   <td><font size="-1">#grp1.w##k1#</font></td>

Is that possible, I keep getting a "element W is undefined" error.

Question by:jcorbin
  • 2
LVL 15

Accepted Solution

danrosenthal earned 100 total points
ID: 12089595
Try this...

<cfset k1 = 0>
<cfoutput query="grp1" >
   <cfset k1 = k1 + 1>
   <td><font size="-1">#evaluate('grp1.w'&k1)#</font></td>

Author Comment

ID: 12089656
dood thats exactly what I wanted! thanks!
LVL 15

Expert Comment

ID: 12089668
no problem

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Redirect website ! 4 54
Website being blocked? 3 129
JKS to store upstart data 2 106
Autoresponder for Whole Domain in Plesk/Cpanel 2 86
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question