Hi all,
I am looking for a simple solution here to avoid a bit of donkey work
basically. I would like to pass an array collection of value objects
to coldfusion to be stored in my database. The only real spanner in
the works is the Objects vary with the amount of data they store i.e.
some have a url value(asset.url) some dont. So its a recursive loop,
yes? So I would expect to insert into the template table for example
asset_id, value: 1 then loop thru all the asset elements adding to the
database. This below is not working though!?
<cfloop FROM="1" TO="#ArrayLen(my_passed_array)#" INDEX="i">
<cfset AssetStruct = StructNew()>
<cfloop COLLECTION="#my_passed_array[i]#" ITEM="y">
<cfif StructKeyExists(my_passed_array[i], y)>
<cfset AssetStruct[#y#] = #my_passed_array[i][y]#>
<cfquery name="mAssets" datasource="#dsn#"
username="#un#" password="#pw#">
INSERT into template
( #y# )
VALUES
( #AssetStruct[y]# )
</cfquery>
</cfif>
</cfloop>
</cfloop>
Thanks Simon
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:5363
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37