Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map

Cancelling a message - part 2

This script is called from the cancel.cfm file.

irt.org logo

My First Forum - a bulletin board application

You are here: irt.org | Articles | Database | My First Forum - a bulletin board application

Published on: Thursday 8th April 1999 By: Andrew Shatwell

<CFINCLUDE TEMPLATE="check.cfm">
<CFQUERY NAME="ArticleDetails" DATASOURCE="#MyDatabase#">
  SELECT * FROM tblArticles WHERE ArticleID = #ArticleID#
</CFQUERY>

<CFIF login.email eq ArticleDetails.UserEmail>

<CFQUERY NAME="DeleteArticle" DATASOURCE="#MyDatabase#">
  DELETE FROM tblArticles WHERE ArticleID = #articleID#
</CFQUERY>

The email address of the user and the author of the message are compared once again. If they match the article is deleted from the tblArticles table.

<CFQUERY NAME="CountArticles" DATASOURCE="#MyDatabase#">
  SELECT * FROM tblArticles WHERE ThreadID = #ArticleDetails.ThreadID#
</CFQUERY>

<CFIF CountArticles.recordcount eq 0>
  <CFQUERY NAME="DeleteThread" DATASOURCE="#MyDatabase#">
    DELETE FROM tblthreads WHERE ThreadID = #ArticleDetails.ThreadID#
  </CFQUERY>
</CFIF>

</CFIF>

<CFLOCATION URL="openthread.cfm?forum=#ArticleDetails.GroupID#&ThreadId=#ArticleDetails.ThreadID#">

The CountArticles query the number of other articles in this thread. If the thread is now empty then the DeleteThread query erases it from the tblThread table.

Finally, the CFLOCATION tag returns the user back to the screen showing the other messages in this thread. If the thread no longer exists, the openthread.cfm file will redirect the user to the openforum.cfm screen where they can view articles in other threads.

Back to Cancelling a message - part 1, or forward to Logging on

Feedback on 'My First Forum - a bulletin board application'

View the author profiles.

What's New

How to do the impossible with Google Gears

Out and About


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.