Just add the queryparam where it is supposed to go on the set.

Also where are people learning to write code like this?

<cfset NewOrder=#ListGetAt(FORM.DisplayOrder, loopcount)#>

The correct way is

<cfset NewOrder = ListGetAt(FORM.DisplayOrder, loopcount) />

Notice that the hashes has been removed!


Regards,
Andrew Scott
http://www.andyscott.id.au/


> -----Original Message-----
> From: David Moore [mailto:[email protected]]
> Sent: Wednesday, 5 January 2011 9:11 AM
> To: cf-talk
> Subject: Best Practive for Updating using cfqueryparam
> 
> 
> What is the best way to write the following update loop using
cfqueryparam?
> 
>   <cfset loopcount=0>
>   <cfloop index="UpdateRecord" list="#FORM.RecordsToUpdate#">
>     <cfset loopcount = loopcount+1>
>     <cfset NewOrder=#ListGetAt(FORM.DisplayOrder, loopcount)#>
>     <cfquery name="updDisplayOrder" datasource="#DSN#"> UPDATE Pages
>     SET Pages.DisplayOrder = #NewOrder#
>     WHERE Pages.PageID = #PageIndex#
>     </cfquery>
>   </cfloop>
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~|
> Order the Adobe Coldfusion Anthology now!
> http://www.amazon.com/Adobe-Coldfusion-
> Anthology/dp/1430272155/?tag=houseoffusion
> Archive: http://www.houseoffusion.com/groups/cf-
> talk/message.cfm/messageid:340424
> Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
> Unsubscribe: http://www.houseoffusion.com/groups/cf-
> talk/unsubscribe.cfm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340427
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to