Thanks Adrian... I was able to use that example as a guide for what I
needed.  A new thing learned today!


-----Original Message-----
From: Adrian Lynch [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 02, 2005 4:06 AM
To: CF-Talk
Subject: RE: a little loop help plz

If I understand correctly, you're looking to loop over two lists at the
same
time.

If the lists are productIDs and quantities then try the following:

<cfloop from="1" to"#ListLen(productIDs)#" index="i">

        <cfoutput>
                <p>
                        Product ID: #ListGetAt(productIDs, i)#<br />
                        Quantity: #ListGetAt(quantities, i)#
                </p>
        </cfoutput>

</cfloop>


Swap in your SQL code and away you go.

Ade

-----Original Message-----
From: Tim Laureska [mailto:[EMAIL PROTECTED]
Sent: 01 October 2005 22:43
To: CF-Talk
Subject: a little loop help plz


I've got a form that passes two variable lists:
1) Product id (could be up to 3 different product id's)
2) Quantity of product corresponding to the product name:

I'm trying to insert the product ids and the product quantities into the
same table.  I can break down and insert one variable list (ex. product
id) into a linking table by using something like:

<cfset product_List="#form.product_id#">
<cfloop index="i" list=#product_list# delimiters=",">
<cfquery datasource="#datasource#">
INSERT INTO products (product_id)
VALUES #i#
</cfquery>
</cfloop>

But If I want to "breakdown" the quantity list for that product_id and
insert it into the same linking table I get stuck

Can someone lend a hand here with a pointer
Thanks
Tim




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219835
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to