Avatar of Zac
ZacFlag for United Kingdom of Great Britain and Northern Ireland asked on

Update multipul rows - its currently inly updating one row at a time

Hi all,

ive got some very simpl code that should update multiple rows in the DB depending on how many check boxes have been selected.

so the user can choose to archive only one record or archive the whole lot. the problem is that only one row is being updated with the archived status which is either 'yes' or 'no'

this all works fine except that onely one record is updated with 'yes' and there for is no displayed when the user retruns to viewapps.cfm

any see what i'm missing?

-------->this form give the user the option of selecting one or multiple rows to update<----------
<form name="confirm_archive" method="POST" action="actions/archiveapps.cfm">
<table border="0" cellpadding="2" cellspacing="2">
    <th nowrap="nowrap">Site</th>
    <th nowrap="nowrap">Applicants name</th>
    <th nowrap="nowrap">Date</th>
  <cfoutput query="get_to_confirm">
<input name="apply_id" type="hidden" value="<cfoutput>#get_to_confirm.apply_id#</cfoutput>"/>
<input name="apply_archive" type="hidden" value="yes" />
<input name="yes" type="submit" value="yes" id="submit_button"  />
<input name="no" type="button" id="submit_button" onclick="MM_goToURL('parent','viewapps.cfm');return document.MM_returnValue" value="no" />
------------>then this action page kicks in on submit<----------
<cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
  <cfquery datasource="xxxx">   
UPDATE vacancy_apps
SET apply_archived= '#FORM.apply_archive#'
WHERE apply_ID in (<cfqueryparam value="#FORM.apply_id#"  list="yes" cfsqltype="cf_sql_numeric">)
  <cflocation url="../viewapps.cfm">

Open in new window

Web ServersColdFusion LanguageSQL

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

yep you got it, thanks alot!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck