Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loops and Lists - ColdFusion rookie 1

Status
Not open for further replies.

ryanrat

IS-IT--Management
Oct 30, 2001
30
US
I have a variable, #form.AddUserID#, that is passed into the page in a list format, sepearted by a comma. The list length is variable(guessing i need to use #ListLen()# at some point). From what I've read in the forums, a <cfloop> is what I need to use, but I'm a little confused on the structure of the loop, and how I should use the index to reference the list. Thanks for all the help.
 
<cfset myList = &quot;#form.AddUserID#&quot;>

<cfloop list=&quot;#myList#&quot; delimiters=&quot;,&quot; index=&quot;ListElement&quot;>

<cfquery ...>
INSERT INTO myTable (userID, Name)
VALUES ('#ListElement#', '')
</cfquery>

</cfloop>

John Hoarty
jhoarty@quickestore.com
 
John -

Thanks! That has totally explained the usage!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top