I'm creating an admin form allowing a user to enter class schedules.
Class Title, Class Description, Class Time, Class Price are all simple
inserts.
The problem comes in when entering the class dates. There are sometimes one
class, sometimes two, four or six. Often times they will be one week apart,
but not always.
example: Class 1 will meet at 2PM on Tuesday the 1st, the 8th, the 15th, the
22nd.
The admin page allows the user to put in the dates desired by clicking on
the appropriate calendar day.
PROBLEM:
One "click" should allow the user to input 2 or more class dates.
A straight loop <cfloop from="1" to="#classQty#"> tries to input multiple
class days into the classDate field.
example of error below:
INSERT INTO classDates
( classID, classDay, classSession, classDates, classTime )
VALUES ( '5', 'Mon', '1', '2003,2003,2003,2003/10,10,10,10/1,8,15,22',
'12:00-2:00' )
SOLUTION ???:
I had thought that I could do something like the following
<cfoutput>
<cfloop from="1" to="#FORM.number#" index="getClassDate">
<cfset
date=#FORM.month##getClassDate#&"/"&#FORM.day1##getClassDate#&"/"&#FORM.year
1##getClassDate#>
<cfquery name="" datasource="">
INSERT INTO classDates
(
classID,
classDay,
classSession,
classDates,
classTime
)
VALUES
(
'#FORM.classID#',
'#FORM.classDay#',
'#FORM.classSession#',
'#date#',
'#FORM.classTime#'
)
</cfquery>
</cfloop>
</cfoutput>
I see why it doesn't work. So, how does one do multiple inserts of this
kind?
Gilbert Midonnet
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

