Hey Kelly,


If I understood it correctly can't you modify your code like this


Size:<input type="text" name="size" size="10">Sku: <input type="text"
name="SKU" size="10">
Size:<input type="text" name="size" size="10">Sku: <input type="text"
name="SKU" size="10">
Size:<input type="text" name="size" size="10">Sku: <input type="text"
name="SKU" size="10">

<cfset skucounter = 1>
<cfloop index="i" list="#form.size#" delimiters=",">
<cfquery name="insertproductsizes" datasource="" username=""
password="">
insert into productsizes
(productid, size,sku)
values
('#variables.newid#', '#i#',#listgetat(form.sku,skucounter,',')#)
</cfquery>
<cfset skucounter = skucounter  + 1>
</cfloop>

Hope it helps


Qasim

-----Original Message-----
From: Kelly Shepard [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 3:06 PM
To: CF-Talk
Subject: Re:looping over form values

Qasim,

The sizes is an insert...there will be no other productid by in there so
I have no need for the where statement.

The behavior that I am seeing is that it is updating each match of
productid with the last value in "sku". What I need is to do the insert
of sizes, then do an update with skus. The table with have rows with
productid1, size1, and sku1...then new row with productid2, size2, and
sku2
instead I am getting:
productid1, size1, and sku2
productid2, size2, and sku2

Does this make sense?

> from your code the behavior that you are seeing is what should be
> expected. I think you will need a where clause for sizes too.

>
Qasim
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to