Skip to main content
Known Participant
November 28, 2008
Question

checkboxes and insert - Help......

  • November 28, 2008
  • 1 reply
  • 365 views
I have 3 tables (locations, categories, location_categories) I need to do an update and insert. Here are the three selects which retrieves the checked categories. How can I do an insert / update into the locations_categories table creating a record for each checkbox that is checked. I know I need to do a loop on a list but not sure how to write it. Here are my select statements.

<cfquery name="getlocations">
SELECT locationid, locname
FROM locations
</cfquery>

<cfquery name="getcategories">
SELECT categoryid, catname
FROM categories
</cfquery>

<cfquery name="loccatselected">
SELECT
categoryid
FROM location_categories
WHERE locationid=#URL.locationid#
</cfquery>
<cfset variables.selectedCategories=ValueList(loccatselected.categoryid)>
This topic has been closed for replies.

1 reply

Inspiring
November 28, 2008