Many thanks again.
Slightly OT - I have learnt CF without any background in programming - I
have a huge problem getting loops and lists to work - I can understand the
general principles but just can't seem to be able to learn to implement
specific code.
For instance I can see what you are doing in the code below and I can adapt
code that other people have done (often by trial and error rather than logic)
BUT i have huge problems coding loops and lists on my own.
Is this normal - or am I just slow???
Any ways to learn how to "roll my own" ???
Many thanks
Seamus
At 11:37 pm 12/07/01 , you wrote:
>There's a couple of ways this can be handled. But, here's what I usually do.
>
><cftransaction>
><cfquery....>
>Delete * from tblClientCategory WHERE clientid=#form.clientid#
></cfquery>
><cfloop from="1" to="#listlen(form.categoryid)#" index="i">
><cfquery....>
>(UPDATE tblClientCategory SET CategoryID=#listgetat(form.categoryid, i)#
>WHERE
>tblClientCategory.ClientID=#form.clientid#)
></cfquery>
></cfloop>
></cftransaction>
>
>Essentially, instead of trying to test for the existence of the categoryid,
>you're just deleting the old and then inserting all the new. <cftransaction>
>is optional here. It ensures that if your second (looped) query doesn't
>work, that you haven't lost your original data. However, if you're
>potentially looping through lots of fields, with non-critical data, you
>might consider the tradeoffs.
>
>-Deanna
>
>
>
>************************************************************
>Deanna Schneider
>Interactive Media Developer
>UWEX Cooperative Extension Electronic Publishing Group
>103 Extension Bldg
>432 N. Lake Street
>Madison, WI 53706
>(608) 265-7923
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists