O'Reilly logo

ColdFusion 8 Developer Tutorial by John Farrar

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

Making Our Data Query Flexible

We set the default value so that the page does not fail if there is no value passed in for the id variable. We added the singular getProduct variable. The only difference is that this will return a single record after the CFC is modified. At present, CFC does not handle the argument, where, even though it is a part of the method. We have to build in the functionality. Change the highlighted lines to make this method work correctly. Since we are not adding the query type to the<cfoutput> tag, it will not loop through the query. It will only return the first record in the recordset. In this instance, there is only one record that will be same. Thus the following code displays only one row on our webpage:

<cfquery datasource="cfb" ...

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