troubleshooting Question

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

Avatar of Zac
ZacFlag for United Kingdom of Great Britain and Northern Ireland asked on
Web ServersColdFusion LanguageSQL
2 Comments1 Solution259 ViewsLast Modified:
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">
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros