Ask a Question related to Coldfusion Database Access, Design and Development.
-
sage703 #1
Entering listbox values into database
Let's say I'm using SESSION variables to create a form-based wizard (it has 12
steps, and therefore 12 pages to the wizard). Some of the values the user
enters/selects/checks (or whatever depending on the form control) will go to
certain tables and other values will go to other tables.
OK, in step 6 of the form wizard the user has to select from a list of
locations that the new program they are entering is offered. Let's say they
select 'Anchorage' and 'Fairbanks'. Now, in the page that processes the form,
one of the <cfquery> INSERT INTO statements inserts the program name and
location for each of the locations selected in step 6 into a table called
Location_Cross_Reference. For each location I want to insert the name of the
program as well as ONE of the locations listed on the list. So, if there were 5
locations selected, then I would want this program name to be entered into that
table 5 times, each time with a different location.
I'm imagining this would incorporate some sort of <cfloop> mechanism, but
having tested it out in various ways I keep getting errors. For example, I
tried setting the <cfloop index="i" list="#SESSION.ProgWiz.Location#"> code
before the INSERT INTO statement (but after the <cfquery> tag, with the end of
the <cfloop> coming after the VALUES() statements. However when I do this the
SQL to the MS Access database tries to enter a program name and BOTH locations
each time it loops. :disgust;
What am I doing wrong?
S./
sage703 Guest
-
Quick Help Please: Null Values in Listbox
I have a list box populated with values from a ColdFusion query, and following each real value in the listbox, there are unselectable "null" values,... -
entering data into MS Access database
Hello, I'm creating an online survey using XHTML -- no PHP -- where the data will be entering into a MS Access database, and I am having trouble... -
Multiple select listbox values in query
I have two listboxes, the first of which is an autopostback=true that allows multiple row selection. When I select multiple values (by holding down... -
Most efficient way of entering data into a SQL database
Sorry this isn't necissarily ASP, but it is VBScript & ADO and I figure that you all would be the best to ask. I am using a VBScript that reads a... -
Adding custom values and database values to DropDwonList
The other way is to create a DataTable, put the --None-- as the first Row, then read the datareader into the DataTable, and append the --other-- at... -
mxstu #2
Re: Entering listbox values into database
If SESSION.ProgWiz.Location is a comma delimited list of locations, then you
need to put the CFQUERY inside the loop:
<!--- psuedo code --->
<cfloop list="#SESSION.ProgWiz.Location#" index="currLocation">
<cfquery .... >
INSERT INTO Location_Cross_Reference (Location, ...)
VALUES ( #currLocation#, ....)
</cfquery>
</cfloop>
Note: You may need to put single quotes around #currLocation# if [Location] is
a "text" column.
mxstu Guest



Reply With Quote

