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">
  <tr>
    <th nowrap="nowrap">Site</th>
    <th nowrap="nowrap">Applicants name</th>
    <th nowrap="nowrap">Date</th>
    </tr>
  <cfoutput query="get_to_confirm">
    <tr>
     
      <td>#get_to_confirm.apply_sitename#</td>
       <td>#get_to_confirm.apply_name#</td>
      <td>#DateFormat(get_to_confirm.apply_datetime)#</td>
      </tr>
  </cfoutput>
</table>
<br>
<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" />
</form>
 
 
 
------------>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">)
  </cfquery>
  <cflocation url="../viewapps.cfm">

Open in new window

Web ServersColdFusion LanguageSQL

Avatar of undefined
Last Comment
Zac

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
gdemaria

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
or
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
ASKER
Zac

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