Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Related items

Exporting data to Word with Cold Fusion

How to update/edit data using Cold Fusion

Introduction to Cold Fusion

Diary of a WebObjects Developer

Building an Internet Database

My First Forum - a bulletin board application- index11

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

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

Cancelling a message - part 2

This script is called from the cancel.cfm file.

<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

Related items

Exporting data to Word with Cold Fusion

How to update/edit data using Cold Fusion

Introduction to Cold Fusion

Diary of a WebObjects Developer

Building an Internet Database

©2018 Martin Webb