EasyCFM.COM ColdFusion Forums / ColdFusion Applications / cfquery insert and cfloop best practice

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: cfquery insert and cfloop best practice

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

08-22-2003 @ 6:14 PM
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 2
Joined: Jul 2003

I have a registration application which allows users to select from a drop down what activity they would like to do on say Saturday and what activity they would like to do on sunday.  On a few  of the activities I have some javascript that asks one or two additional questions.  i.e. if they select massage on saturday then an additional drop down appears asking male or female.  same with golf two additional question fields display asking rental clubs and handicap... That's fine.

The question is, I am not quite sure how to properly input these into the database.  It would make sense to do a cfloop with an insert cfquery, but then the question is... The once the user registers he is allows to go back and change is registration options, so the user may not have selecting any activities initially, but then when they update their record wants to add some.

Also I am wondering if I have named my fiends correctly,

Basically I have an invitee saturday and sunday activity selection and a guest saturday and sunday activity selection.  I thought I would name both the invitee drop downs the same, inv_activity, with the option_1 and option_2 fields being the fields to capture any optional data for massage or golf and gst_activity with the same optional fields as well.

Anyway, i'm a little stumped here.  Just want to know what makes the most sense.


08-25-2003 @ 9:43 AM
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 71
Joined: Feb 2003


From what you described, you may want to design a database like this:

[people] -->> [fun]  
(people includes both invitees and guests)
(fun includes all sort of activities)
(The above people to fun relationship is one to many, so, Joe could sign up for massage and other stuff )

As for insert and cfloop best practice, try the following pattern whenever applicable,

insert into TBL(col1) values ('abc');
end cfloop
end cfquery

Li, Chunshen (Don)


Website Designed and Developed by Pablo Varando.