[Webinar] Learn how to a build a cloud-first strategyRegister Now


Update multiple records from a list

Posted on 2014-08-14
Medium Priority
Last Modified: 2014-08-14
I have a text field and some checkboxes. When the form is submitted the check boxes create a list. The field is called "selected". So, After the form is submitted I have a 2 fields, one is a list of numbers(selected)  like this 3,7,9,10 and a value from the text box "car",

The values from "Selected" are the IDs from each record i would like to update. So, if the boxes 5,6,7 were checked I want to update records with ID 5,6,7 with the value from the text box.

Could someone assist with this? I'd like to avoid having a query in a loop. Thank you.
Question by:earwig75
LVL 39

Accepted Solution

gdemaria earned 2000 total points
ID: 40261335
Just use....    in ()

update theTable
   set aColumn = 'Something'
where primaryKey_id in (#form.IDlist#)

Author Comment

ID: 40261361
Thank you, I don't know why I forgot about "IN". I did have to do it this way though: IN (<cfqueryparam value = "#form.SELECTED#" list="true" CFSQLType = "CF_SQL_BIGINT">)

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Screencast - Getting to Know the Pipeline
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question