Processing Additions

The next thing you need is a template to process the actual data insertion—the ACTION page mentioned earlier. In this page use the SQL INSERT statement to add the new row to the Films table.

See Chapter 7, “SQL Data Manipulation,” for an explanation of the INSERT statement.

As shown in Listing 14.4, the <cfquery> tag can be used to pass any SQL statement—not just SELECT statements. The SQL statement here is INSERT, which adds a row to the Films table and sets the values in seven columns to the form values passed by the browser.

Listing 14.4. insert2.cfm—Adding Data with the SQL INSERT Statement
<!--- Name: insert2.cfm Author: Ben Forta (ben@forta.com) Description: Table row insertion demo Created: 07/01/07 ---> <!--- Insert ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.