We help IT Professionals succeed at work.
Get Started

looping and updating

nmarano asked
Last Modified: 2012-05-12

I'm trying to make an update to a table setting the pageNum in the table, but am having some trouble doing so.  what seems to be happening is I am the pageNum is being set to totalPageCount rather than incrementing from 1 to totalpagecount.  Any help would be appreciated.  I basically trying to loop from 1 to totalpagecount and update pageNum in my db to reflect whichever number is current in my loop.  Hopefully this makes sense.

<cfset addPageNum = valueList(getPageNum.tExitSubSectionItemID)><!--- looks like 'surveyAT198,surveyAT199,surveyAT200' --->
<cfset totalPageCount = listLen(addPageNum)><cfdump var="#totalPageCount#">
<cfloop index="i" from="1" to="#totalPageCount#">
<cfloop list="#addPageNum#" index="j">
       <cfoutput query="getPageNum">
         <cfquery name="addnum" datasource="#request.datasource#">
               UPDATE tSubsectionStatus
               SET pageNum = <cfoutput>#i#</cfoutput>
                WHERE tTeacherID = #session.teacher.id#
                AND tExitSubSectionItemID = <cfoutput>'#j#'</cfoutput>
Watch Question
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE