Yes as a "complex" type is always better to declare an array, and the housework that goes with it.
Peter Tilbrook Managing Director, ColdGen Internet Solutions Professional Adobe ColdFusion 9 Application Development President, ACT and Region ColdFusion Users Group PO Box 2247 Queanbeyan, NSW, 2620 AUSTRALIA Tel: +61-2-6284-2727 Email Address: pe...@coldgen.com WWW: http://www.coldgen.com/ ABN: 80 826 226 128 On 22 June 2010 00:25, Brett Payne-Rhodes <bret...@gmail.com> wrote: > Hi Claude, > > This works for me... > > <cfparam name="session.cart" default="#arrayNew(1)#"> > <cfset myCartItem = structNew()> > <cfset myCartItem.itemID = form.itemID> > <cfset myCartItem.quantity = form.quantity> > <cfset myCartItem.itemName = form.itemName> > <cfset result = arrayAppend( session.cart, myCartItem )> > > > Cheers, > > Brett > B) > > > > > > rai...@ozemail.com.au wrote: > >> Hi >> >> >> I am trying my hand at a basic shopping cart >> >> >> I have found an example online that uses the following code >> >> >> <cfparam name="session.cart" default="arrayNew()"> >> >> <cfset session.cart = arrayAppend( session.cart, structNew() )> >> >> <cfset thisCartItem = arraylen( session.cart )> >> >> <cfset session.cart[thisCartItem].itemID = form.itemID> >> >> <cfset session.cart[thisCartItem].quantity = form.quantity> >> >> <cfset session.cart[thisCartItem].itemName = form.itemName> >> >> >> >> However the code generates the following error message: >> >> >> *Object of type class java.lang.String cannot be used as an array * >> >> >> >> If someone would like to advise where the above code is causing the error >> message I would be grateful >> >> Regards >> >> Claude Raiola (B.Econ Acc; B.Hot. Mngt) >> Samaris Software >> Email: i...@samaris.net <mailto:i...@trackingcentral.om.au> >> Website: www.SAMARIS.net <http://www.TrackingCentral.com.au> >> >> Mobile: 0414 228 948 >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "cfaussie" group. >> To post to this group, send email to cfaus...@googlegroups.com. >> To unsubscribe from this group, send email to >> cfaussie+unsubscr...@googlegroups.com<cfaussie%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/cfaussie?hl=en. >> > > -- > Brett Payne-Rhodes > YourSite Web Solutions > w: http://www.yoursite.net.au > e: br...@ehc.net.au > t: +61 (0)8 9371-0471 > m: +61 (0)414 371 047 > > > -- > You received this message because you are subscribed to the Google Groups > "cfaussie" group. > To post to this group, send email to cfaus...@googlegroups.com. > To unsubscribe from this group, send email to > cfaussie+unsubscr...@googlegroups.com<cfaussie%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/cfaussie?hl=en. > > -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaus...@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.