I'm back with another question ( imagine that :)
First i would like to say thanks to everyone that has helped me so far a lot of things
have worked great!
what i have is a form that has 6 selection box's (all multiple select box's) which
list's all of the contestans in a circuit.
if i select just one person for each place 1st through 6th everything is great.
however when i need to select two for
a place (example: tie in first or something like that) im trying to get the insert
page to put each contestant on there own
row in the DB. rather than put a comma between the ContestantID's This is what i have
now but for some reason it still adds the
comma's and doesnt put them on there own row.
<!-- Adds Records To The DB. -->
<cfloop index="LoopList" list="#form.LoopList#">
<cfset RodeoID = #Form.RodeoID#>
<cfset EventID = #Form.EventID#>
<cfset Place = #LoopList#>
<cfset TimeTaken = #Evaluate("form.Place#LoopList#TimeTaken")#>
<cfset Points = #Evaluate("form.Place#LoopList#Points")#>
<cfset AdjPoints = #Evaluate("form.Place#LoopList#AdjPoints")#>
<cfset MoneyEarned = #Evaluate("form.Place#LoopList#MoneyEarned")#>
<cfset NotAllAround = #Evaluate("form.Place#LoopList#NotAllAround")#>
<cfset ListCheck = #ListLen("form.Place#LoopList#ContestantID")#>
<!-- If Form only has 1 entry for each place 1st through 6th (NO TIES) -->
<!-- Adds a row for each Contestant Selected in form -->
<cfif ListCheck EQ 1>
<cfset ContestantID = #Evaluate("form.Place#LoopList#ContestantID")#>
<cfquery name="PutResults" datasource="#datasource#" username="#username#"
password="#password#" dbtype="ODBC">
INSERT INTO ResultsManager (RodeoID, EventID, ContestantID, Place, TimeTaken, Points,
AdjPoints, MoneyEarned, NotAllAround)
VALUES (
'#RodeoID#',
'#EventID#',
'#ContestantID#',
#Place#,
#TimeTaken#,
#Points#,
#AdjPoints#,
#MoneyEarned#,
#NotAllAround#)
</cfquery>
<cfelse>
<!-- If Form has more than on entry for any of the places 1st through 6th ex: a tie in
first OR second ect... -->
<!-- Should enter a new row for each ContestantID that is selected in the multiple
select box's -->
<!-- rather than adding a comma ',' between their ID Number in the same row -->
<cfloop index="LoopContestantID" list="#form.Place#LoopList#ContestantID#">
<cfset ContestantID = #LoopContestantID#>
<cfquery name="PutResults" datasource="#datasource#" username="#username#"
password="#password#" dbtype="ODBC">
INSERT INTO ResultsManager (RodeoID, EventID, ContestantID, Place, TimeTaken, Points,
AdjPoints, MoneyEarned, NotAllAround)
VALUES (
'#RodeoID#',
'#EventID#',
'#ContestantID#',
#Place#,
#TimeTaken#,
#Points#,
#AdjPoints#,
#MoneyEarned#,
#NotAllAround#)
</cfquery>
</cfloop>
</cfif>
</cfloop>
Jay Patton
Web Design / Application Design
Web Pro USA
406.549.3337 ext. 203
1.888.5WEBPRO
www.webpro-usa.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists