Gilbert,

1) Use the CreateODBCDate function

i.e CreateODBCDate(createdate(form.year,form.month,form.day)) This will fix the date formating problem

2) Think about using a seperate lookup table associating classes with times. This way you can CFLoop around the infoirmation and pull the dates into the database correctly using the CreateODBCDate function. This way you can have as many dates as needed for each class.

You should be able to loop over the list and insert the transaction, as long as you have CFTRANSACTION tags and a CFTRY/CFCATCH block around the insert

To pull the items from the database for the dates later all you'll need to do is use a inner join.

3) Are you calling CFSET statement correctly? <cfset #FORM.month##getClassDate# ... outputs at 101  102  103. If you use <cfset #evaluate("FORM.month#getClassDate#")> This will output the variable you passing month1 correctly.

In my pervious example it would be
CreateODBCDate(createdate(evaluate("form.year#getClassDate#"),evalaute("form.month#getClassDate#",evalaute("form.day#getClassDate#"))

Jeremy Brodie
Intelix
an Edgewater Technology Solutions Company

web: http://www.edgewater.com
phone:(703) 815-2500
nasdaq symbol: EDGE


>BACKGROUND INFO:
>
>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]

Reply via email to