The magic for running a lot of queries with Railo stems from the
<cfquery> tag. This is a very versatile tag that allows you to run queries to a data source. Remember, we queried the database to get our list of employees? Let's do that in CFML to see how easy it is to do.
<cfquery name="getEmployees" datasource="railobook"> SELECT * FROM employee </cfquery> <cfloop query="getEmployees"> <cfoutput>#FirstName# #LastName# <br></cfoutput> </cfloop>>
We use the
<cfquery> tag, setting the name of the results to
getEmployees by putting that in the
name attribute. We also use the
datasource attribute to say we are going to use the datasource we setup, called
Then we put the SQL ...