Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Deleting multiple records with coldfusion

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

delete_assesment.cfm:
<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
</cfquery>
<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)>

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

<body>

<table border="1">
<tr>
<td>HandOutDate</td>
<td>HandInDate</td>
<td>AssesmentID</td>
<td>Strand</td>
<td>ModuleName</td>
<td>Tutor</td>
<td>&nbsp;</td>
</tr>
<cfoutput query="DelAssesment" startRow="#StartRow_DelAssesment#" maxRows="#MaxRows_DelAssesment#">
<tr>
<td>#DelAssesment.HandOutDate#</td>
<td>#DelAssesment.HandInDate#</td>
<td>#DelAssesment.AssesmentID#</td>
<td>#DelAssesment.Strand#</td>
<td>#DelAssesment.ModuleName#</td>
<td>#DelAssesment.Tutor#</td>
<td><a href="deleteConfirm.cfm">Delete</a></td>
</tr>
</cfoutput>
</table>

</body>
</html>

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

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

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

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

</body>
</html>

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
0
Comment
Question by:sagat4
[X]
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
6 Comments
 
LVL 7

Expert Comment

by:suramsureshbabu
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
0
 
LVL 7

Accepted Solution

by:
suramsureshbabu earned 200 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.
0
 

Author Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

610 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