I am almost done with a registration form for events. I am bringing in all my values throught my session.Crtcalid. My problem is that if there are 3 events a user signed up for the session.crtcalid inserts all the values of that field on the column rathen than one at a time loop and insert the values again. Here is the code I was using before.
<cfloop index="IndexCount" from="1" To="#ListLen(Session.Crtcalid, "^"#">
<cfoutput>
<cfset xname = #ListGetAt(Session.Crtxname, IndexCount, "^"#>
<cfset ProdQty = #ListGetAt(Session.CrtQuantity, IndexCount, "^"#>
<cfset ProdCost = #ListGetAt(Session.CrtPrice, IndexCount, "^"# *
#ListGetAt(Session.CrtQuantity, IndexCount, "^"#>
</cfoutput>
<CFQUERY Name = "AddItemsToDbase" Datasource = #application.dsn#>
--insert here-----
I got the following error due to the loop inserting all the values at once of session.crtcalid.
Error","5384","09/03/03","17:10:37",,"xxx.xx.xxx.xxx, Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322), ODBC Error Code = 22001 (String data right truncation)<P><P> [MERANT][ODBC Oracle 8 driver][Oracle 8]ORA-01401: inserted value too large for column <P><P><p>The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (73:1) to (73:75).</p><P><P>Date/Time: 09/03/03 17:10:36
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Remote Address: xxx.xx.xxx.xxx
HTTP Referrer: I went ahead and chaged the loop to the following to see if it got better.
<cfset num_of_recurs = #Session.Crtcalid#>
<cfloop index="IndexCount" from="1" to="#ListLen(num_of_recurs)#">
<CFQUERY Name = "AddtemsToDbase" Datasource = #application.dsn#>
I have 14 inserts on this query and it keeps inserting all values at once. The session crt.calid holds the id for each event but it keeps trying to insert all values in one row. How can I break this down so that for each event there is a row added to the db? Any ideas how I can set up the loop.
This is the error that I am getting now.
"Error","3164","09/05/03","10:08:13",,"xxx.xx.xxx.xxx, Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322), TO<P> Cannot convert 0000002394^0000002408 to number.<P>Please, check the ColdFusion manual for the allowed conversions between data types<p>The error occurred while processing an element with a general identifier of (CFLOOP), occupying document position (62:1) to (62:48).</p><P><P>Date/Time: 09/05/03 10:08:13
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Remote Address: xxx.xx.xxx.xxx
HTTP Referrer:
ANy suggestions would be appreciated.
<cfloop index="IndexCount" from="1" To="#ListLen(Session.Crtcalid, "^"#">
<cfoutput>
<cfset xname = #ListGetAt(Session.Crtxname, IndexCount, "^"#>
<cfset ProdQty = #ListGetAt(Session.CrtQuantity, IndexCount, "^"#>
<cfset ProdCost = #ListGetAt(Session.CrtPrice, IndexCount, "^"# *
#ListGetAt(Session.CrtQuantity, IndexCount, "^"#>
</cfoutput>
<CFQUERY Name = "AddItemsToDbase" Datasource = #application.dsn#>
--insert here-----
I got the following error due to the loop inserting all the values at once of session.crtcalid.
Error","5384","09/03/03","17:10:37",,"xxx.xx.xxx.xxx, Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322), ODBC Error Code = 22001 (String data right truncation)<P><P> [MERANT][ODBC Oracle 8 driver][Oracle 8]ORA-01401: inserted value too large for column <P><P><p>The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (73:1) to (73:75).</p><P><P>Date/Time: 09/03/03 17:10:36
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Remote Address: xxx.xx.xxx.xxx
HTTP Referrer: I went ahead and chaged the loop to the following to see if it got better.
<cfset num_of_recurs = #Session.Crtcalid#>
<cfloop index="IndexCount" from="1" to="#ListLen(num_of_recurs)#">
<CFQUERY Name = "AddtemsToDbase" Datasource = #application.dsn#>
I have 14 inserts on this query and it keeps inserting all values at once. The session crt.calid holds the id for each event but it keeps trying to insert all values in one row. How can I break this down so that for each event there is a row added to the db? Any ideas how I can set up the loop.
This is the error that I am getting now.
"Error","3164","09/05/03","10:08:13",,"xxx.xx.xxx.xxx, Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322), TO<P> Cannot convert 0000002394^0000002408 to number.<P>Please, check the ColdFusion manual for the allowed conversions between data types<p>The error occurred while processing an element with a general identifier of (CFLOOP), occupying document position (62:1) to (62:48).</p><P><P>Date/Time: 09/05/03 10:08:13
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Remote Address: xxx.xx.xxx.xxx
HTTP Referrer:
ANy suggestions would be appreciated.