O'Reilly logo

Object-Oriented Programming in ColdFusion by Matt Gifford

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

A typical ColdFusion Gateway

As our introduction into Gateway objects, we will create an object that will allow us to query our database table of users to retrieve a large query of all records stored, as well as methods that will allow us to search or 'filter' the data to return specific records based upon criteria, suitable for a search interface.

Firstly, let's create a new ColdFusion template file and save it with the name listUsers.cfm. This page will form part of our user management application, and will list all Users currently stored within the database.

Let's add the following code into the listUsers.cfm file:

<cfquery name="qlistUsers" datasource="CFOOP" username="<username>" password="<password>"> SELECT ID, firstName, lastName, username, ...

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