Hey, I'm new here, so I have a question. I did a form in coldfusion that creates tables of data of students when they submit their info, but when a dates comes the superadmin can purge the old dates of the data and this deletes the entries with this date.

So this is what we did:

<cfif Session.type neq 'super'>
You are not authorized for this page
<cfabort>
<cfelse>

<cfif NOT IsDefined("form.date")>
<h1>You did not specify the Date</h1>
Please try again <a href="purge_database.cfm">here</a>
<cfabort>
</cfif>

<cfquery datasource="aasdfaa">
DELETE FROM DATABASE
WHERE year < '#Right(form.date,2)#'
</cfquery>
<cfquery datasource="aasdfaa">
DELETE FROM DATABASE
WHERE year = '#Right(form.date,2)#' AND projgraddate<='#form.date#'
</cfquery>
<cflocation url="index.cfm">
</cfif>

So the question is how can I show the numbers of deleted entries?

1) Give your query a name:

<cfquery name="DeleteRecords" datasource="aasdfaa">
DELETE FROM DATABASE
WHERE year = '#Right(form.date,2)#' AND projgraddate<='#form.date#'
</cfquery>


2) Output the recordcount of the query:

<cfoutput>#DeleteRecords.RecordCount#</cfoutput>


Hey, I'm new here, so I have a question. I did a form in coldfusion that creates tables of data of students when they submit their info, but when a dates comes the superadmin can purge the old dates of the data and this deletes the entries with this date.

So this is what we did:

<cfif Session.type neq 'super'>
You are not authorized for this page
<cfabort>
<cfelse>

<cfif NOT IsDefined("form.date")>
<h1>You did not specify the Date</h1>
Please try again <a href="purge_database.cfm">here</a>
<cfabort>
</cfif>

<cfquery datasource="aasdfaa">
DELETE FROM DATABASE
WHERE year < '#Right(form.date,2)#'
</cfquery>
<cfquery datasource="aasdfaa">
DELETE FROM DATABASE
WHERE year = '#Right(form.date,2)#' AND projgraddate<='#form.date#'
</cfquery>
<cflocation url="index.cfm">
</cfif>

So the question is how can I show the numbers of deleted entries?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.