>
> I am new to structures and arrays, and I need to insert the
> results of a cfloop on the array into my database. Can you
> insert a cfloop? Sample array output in below I have
> removed the table formating code:
That's not a problem
You can put a CFQUERY pretty much anywhere in code except for in another
CFQUERY (and a few other tags)
While within your loop you can just CFQUERY to insert your data
<cfloop from="1" to="#ArrayLen(Session.Cart.productID)#"
index="ThisItem">
<cfquery datasource="myDSN" name="insert">
insert into MyTable (ProductID, ProductTitle, Qty, Total)
values (
<cfqueryparam cfsqltype="CF_SQL_INTEGER"
value="#Session.Cart.productID[ThisItem]#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="#Session.Cart.productTitle[ThisItem]#">,
<cfqueryparam cfsqltype="CF_SQL_INTEGER"
value="#Session.Cart.Qty[ThisItem]#">,
<cfqueryparam cfsqltype="CF_SQL_MONEY"
value="#Session.itemTotal#">
)
</cfquery>
</cfloop>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

