chrissp26
asked on
Updating multiple records at once.
Hello,
I have a number of checkboxes on a field all have the same name: addedToSage. When multiple checkboxes are selected the output appears like this:
1,2,3,4,5,6,7,8,9,10 etc etc
Those are the ID's of the records I have outputted on the page.
What i'm trying to do is update each record by the ID listed in the outputted variable when someone hits submit.
So essentially what I need to do is this:
<cfquery name="updateRecords" dataSource="#dsl#">
UPDATE SET
addedToSage = "true"
WHERE ID = #FORM.addedToSage#
</cfquery>
This doesn't work. So is it a case of using listLen and establishing the length of the addedToSage string and then using a loop to update each record in turn?
Thanks for you time
Chris
I have a number of checkboxes on a field all have the same name: addedToSage. When multiple checkboxes are selected the output appears like this:
1,2,3,4,5,6,7,8,9,10 etc etc
Those are the ID's of the records I have outputted on the page.
What i'm trying to do is update each record by the ID listed in the outputted variable when someone hits submit.
So essentially what I need to do is this:
<cfquery name="updateRecords" dataSource="#dsl#">
UPDATE SET
addedToSage = "true"
WHERE ID = #FORM.addedToSage#
</cfquery>
This doesn't work. So is it a case of using listLen and establishing the length of the addedToSage string and then using a loop to update each record in turn?
Thanks for you time
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.