Skip to main content
Inspiring
July 9, 2008
Question

cfloop problem

  • July 9, 2008
  • 1 reply
  • 334 views
Hi Folks,

I'm currently trying to loop through the posted form variables that are created on the fly. Using the code attached. However I get a very undesciprive error message which doesn't help at all, Can anyone help?

Thankyou

Error Occurred While Processing Request
400 : <cfif type eq 'pt'>
401 :
402 : <cfset endTime = createdateTime(form["startday"& i], form["startmonth"& i], form["startyear"& i], form["endhour"& i], form["endmin"& i],0)>
403 : </cfif>
404 : INSERT INTO coursesessions (sessioncourse,sessionstartdate,sessionenddate,sessionvenue) VALUES (#courseid#,#newstartTime#, #endTime#,#form["courselocation"& i]#)


This topic has been closed for replies.

1 reply

Inspiring
July 9, 2008
hmmm... You have tried performing sql before, or maybe many times already in cf, right? Put your INSERT statement inside a <cfquery> tag and use <cfqueryparam> tag in your inserted values. :)

Also, you declared a variable sessionum and use a sessionNum variable in your loop. Notice the latter has two letter "n" while the previous has only one.

Also, what if your type is not equal to "pt"? newstartTime and endTime variables will be undefined then, unless you have initialized these two variables already somewhere before the code you posted.