Querying a Database Using Coldfusion
A simple coldfusion tutorial which explains how to query a database using coldfusion.
Querying a database in coldfusion is similar to other programming languages. The query is usually placed at the top of the page, or before where it is used.
The query is as below with an opening <cfquery> tag with the name of the query and the datasource that you are querying. Between the opening and closing <cfquery> tags you insert your sql code.
SELECT *
FROM table
</cfquery>
To output your retrieved data into the page you need to use the <cfoutput> tag, this tag lets the coldfusion server know that you are going to be outputting dynamic data.
the out put is simple between <cfoutput> tags you use # surrounding the data, to call from your query you would use the script.
The output is structured by using the query name to select what table you are outputting from and then the attribute would be equal the the row in a database.


There are no comments for this entry.
[Add Comment]