Deleting multiple records with coldfusion

Posted on 2004-08-30
Last Modified: 2013-12-16
hi all, this is the script i have for deleting records:

<cfparam name="PageNum_DelAssesment" default="1">
<cfquery name="DelAssesment" datasource="netteh">
SELECT Assesment.HandOutDate, Assesment.HandInDate, Assesment.AssesmentID, Assesment.Strand,
Assesment.ModuleName, Assesment.Tutor FROM Assesment
<cfset MaxRows_DelAssesment=10>
<cfset StartRow_DelAssesment=Min((PageNum_DelAssesment-1)*MaxRows_DelAssesment+1,Max(DelAssesment.RecordCount,1))>
<cfset EndRow_DelAssesment=Min(StartRow_DelAssesment+MaxRows_DelAssesment-1,DelAssesment.RecordCount)>
<cfset TotalPages_DelAssesment=Ceiling(DelAssesment.RecordCount/MaxRows_DelAssesment)>

<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<table border="1">
<cfoutput query="DelAssesment" startRow="#StartRow_DelAssesment#" maxRows="#MaxRows_DelAssesment#">
<td><a href="deleteConfirm.cfm">Delete</a></td>


<cfquery name="Hand1" datasource="netteh">
SELECT Assesment.HandOutDate FROM Assesment
<cfquery name="hand2" datasource="netteh">
SELECT Assesment.HandInDate FROM Assesment
<cfquery name="ID" datasource="netteh">
SELECT Assesment.AssesmentID FROM Assesment
<cfquery name="strand" datasource="netteh">
SELECT Assesment.Strand FROM Assesment
<cfquery name="ModName" datasource="netteh">
SELECT Assesment.ModuleName FROM Assesment
<cfquery name="Tut" datasource="netteh">
SELECT Assesment.Tutor FROM Assesment
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<form name="form1" method="post" action="">
<input type="hidden" name="hiddenField">
Please confirm that you want to delete this record</p>
<form name="form2" method="post" action="">
<input name="textfield" type="text" value="<cfoutput>#Hand1.HandOutDate#</cfoutput>">
<form name="form3" method="post" action="">
<input name="textfield2" type="text" value="<cfoutput>#hand2.HandInDate#</cfoutput>">
<form name="form4" method="post" action="">
<input name="textfield3" type="text" value="<cfoutput>#ID.AssesmentID#</cfoutput>">
<form name="form5" method="post" action="">
<input name="textfield4" type="text" value="<cfoutput>#strand.Strand#</cfoutput>">
<form name="form6" method="post" action="">
<input name="textfield5" type="text" value="<cfoutput>#ModName.ModuleName#</cfoutput>">
<form name="form7" method="post" action="">
<input name="textfield6" type="text" value="<cfoutput>#Tut.Tutor#</cfoutput>">
<p> <a href="confirmed.cfm"><strong>CONFIRM DELETION</strong></a></p>
<p>&nbsp; </p>

and finally confirm.cfm:
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<cfif IsDefined("FORM.AssesmentID") AND #FORM.AssesmentID# NEQ "">
<cfquery datasource="netteh">
DELETE FROM Assesment WHERE AssesmentID=#FORM.AssesmentID#
<cflocation url="confirmed2.cfm">


it works fine except when it comes to the last page which is the confirm.cfm that nothing happens. please can anyone make any corrections? thanks
Question by:sagat4
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 11938541
you are calling "confirmed.cfm" in the Deleteconfrim.cfm page but the name of the page is "confirm.cfm" change the name to "confirmed.cfm" it will work

Accepted Solution

suramsureshbabu earned 50 total points
ID: 11938558
and also in the
<cfif IsDefined("FORM.AssesmentID") AND #FORM.AssesmentID# NEQ "">

you are trying to access "AssesmentID" from FORM which i cannot see in the confirm.cfm page.

Author Comment

ID: 12235911
Don't worry guys i have found the solution already. Thanks for your help though but sorry nobody gets any points today

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
video playback resume on webpages 2 88
Getting attribute Values using xslt 4 67
Problem to echo 6 116
Grunt No Clean Targets 6 303
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure ( It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The viewer will learn how to dynamically set the form action using jQuery.

732 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