Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfloop problem

Participant ,
Jul 09, 2008 Jul 09, 2008
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]#)


TOPICS
Getting started
300
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 09, 2008 Jul 09, 2008
LATEST
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources