Back to Papers and Articles | |
Database Web Programming with Cold Fusion Copyright 2000 Paragon Corporation ( January 25, 2000) |
|
Cold Fusion is a fast and relatively easy tool for creating active web content. It is a great tool because it makes simple query tasks easy, and at the same time, provides the flexibility to accomplish more complex queries.
In this article, we will focus on using cold fusion as a web development tool for gathering information from a relational database. Most of the focus will be on the CFOUTPUT and CFQUERY tags and how to use these together to create simple pages, and then do more complex activities such as nested queries. The most flexible way to query a database and display database output in Cold Fusion is with the <CFQUERY> and <CFOUTPUT> tag constructs. CFQUERY is used to retrieve database information from a database and CFOUTPUT is used to output the information to a web page. Below is an example use of the <CFQUERY> and <CFOUTPUT> tags.
The above example demonstrates querying a database to get the current day's events, and displaying these events in an HTML table. This example assumes that a DNS myds has been registered on the Cold Fusion Server. Note for this particular example, we could just have easily used the <CFTABLE> construct to accomplish the same task in fewer lines, but a <CFOUTPUT> allows for more control at the price of ease of use. | |
Back to Papers and Articles | |
|