O'Reilly logo

Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started by Charlie Arehart, Raymond Camden, Ben Forta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Deleting Data with ColdFusion

ColdFusion is very efficient at adding and updating data, but not at deleting it. DELETE is always a dangerous operation, and the ColdFusion developers didn’t want to make it too easy to delete data by mistake.

To delete data in a ColdFusion template, you must use the SQL DELETE statement, as shown in Listing 14.12. The code first checks to ensure that a FilmID was passed; if the URL.FilmID field isn’t present, the statement terminates. If a FilmID is passed, a <cfquery> is used to pass a SQL DELETE statement to the data source.

See Chapter 6 for an explanation of the DELETE statement.
Listing 14.12. delete1.cfm—Deleting Table Data with SQL DELETE
<!--- Name: delete1.cfm Author: Ben Forta (ben@forta.com) Description: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required