many thanks - works well and looks like more elegant code.

I now have another problem and would appreciate any help.

I want to be able to update from this form; and have 2 problems.
1. how do I loop thru all my categoryID's    I get this sql and an error on 
a straight update
(UPDATE tblClientCategory SET CategoryID=1,2 WHERE 
tblClientCategory.ClientID=3)

2. How do I set it to update if clientID/categoryID already exists, delete 
or insert?

Hope this is not too much of an ask?

Many thanks

Seamus



At 12:21 am 12/07/01 , you wrote:
>I handle this in a different way. Here's what I would do:
><cfquery name="getAllCats" datasource="#application.DSN#">
>SELECT CategoryID, Category
>FROM tblClientCategoryTypes
></cfquery>
>
><cfquery name="getCats" datasource="#application.DSN#">
>SELECT ClientID, CategoryID
>FROM tblClientCategory
>WHERE ClientID=#FORM.ClientID#
></cfquery>
><!---Create a list of selected categories--->
><cfset selectedcats = valuelist(getcats.categoryid)>
><form action="action.cfm" method="post">
><!---Output all categories, checking for the the selected categories.--->
><cfoutput query="getallcats">
><input type="checkbox" name="CategoryID" value=""
><CFIF listfind(selectedcats, categoryid) GT "0">checked</CFIF>><br>
></cfoutput>
></form>
>
>Make sense? If you're doing this a lot, you might want to make the list an
>array, which will process a bit faster, but if it's a short list, I don't
>bother.
>
>-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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to