You need to loop over the comma delimited list, doing multiple inserts:

<cfquery name="insertGirls" datasource="#request.dsn#">
        <cfloop list="#form.girls#" index="i">          
                Insert into testRoster(
                        Girl_name
                )
                Values(
                '#i#'
                )
        </cfloop>
</cfquery>
                

> -----Original Message-----
> From: Peter Tanswell [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 21, 2006 2:04 PM
> To: CF-Talk
> Subject: creating a new record in a db table
> 
> OK here is a summary of what I'm trying to achieve.
> 
> 
> 
> I have displayed on the screen two select lists.  A user is then able to
> select names from one select list to the other.  In fact, the select list
> on
> the lest is a master list so all the names will appear in that list.
> 
> 
> 
> Lets say a user selects 10 names from the list on the left and moves them
> to
> the list on the right.
> 
> 
> 
> When the user clicks submit I want to create a table that contains one
> record for each name in the table on the right.
> 
> 
> 
> Currently I have the following:
> 
> 
> 
> I am displaying individual lines on the scree, but in the DB I am just
> getting one record created,  The format of the record being the id field
> and
> then the name field which looks like:
> 
> 
> 
> Abby,Bthe,Cindy,Coral    -  basically comma delimted where as I want in
> this
> case 4 separate records created in the DB.
> 
> 
> 
> Thanks in advance for any feedback
> 
> 
> 
> 
> 
> 
> 
> <cfset girls = '#form.sel#'>
> 
> <cfloop list="#girls#" index="i">
> 
>             <cfoutput>#i#<br></cfoutput>
> 
> </cfloop>
> 
> 
> 
> 
> 
> <cfquery datasource="#Request.DSN#">
> 
> Insert into testRoster
> 
> (girl_name)
> 
> Values
> 
> ('#girls#')
> 
> </cfquery>
> 
> 
> 
> 
> 
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250490
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to