SQL Query
<cfquery datasource="ds" name="query_name">
 SELECT column FROM table
 WHERE id = <cfqueryparam cfsqltype="cf_sql_integer" 
  value="#url.id#">
</cfquery>
Query Of Query
<cfquery dbtype="query" name="query_name">
 SELECT column FROM existing_query
</cfquery>
Loop over Query
<cfoutput query="query_name">
 #query_name.currentrow#
</cfoutput>
Loop over a List
<cfloop list="#list#" index="item">
 <cfoutput>#item#</cfoutput>
</cfloop>
CFCHART
<cfchart><cfchartseries 
 type="bar/line/pie/curve/area/scatter"
 query="qName" itemcolumn="itm"
 valuecolumn="val"></cfchart>
DateDiff
#DateDiff("yyyy", "1/1/00", "1/1/09")# = 9
#DateDiff("yyyy", "1/1/09", "1/1/00")# = -9
CFMAIL
<cfmail to="to" from="from" subject="sub"
 type="HTML">Mail Message</cfmail>
CFMAIL Query
<cfmail to="#to#" from="from" subject="sub"
  query="q">Hi, #firstname# ...</cfmail>
CFHTTP
<cfhttp url="http://x.com/" />
<cfoutput>#cfhttp.filecontent#</cfoutput>
CFTRY / CFCATCH
<cftry>
 <cfset x = 5/0>
 <cfcatch type="any">Error</cfcatch>
</cftry>
CFHEADER
<cfheader name="Location" value="/foo">
<cfheader statuscode="301" 
 statustext="Moved Permanently">
CFSEARCH
<cfsearch name="q" collection="c"
 criteria="terms" type="simple">
<cfoutput query="q">
 #q.title# - #q.summary# #q.key# #q.score#
</cfoutput>
Dump a Variable
<cfdump var="#var#">
CFFILE action="read"
<cffile action="read" file="/path" variable="var">
CFFILE action="write"
<cffile action="write" file="/path" output="#content#">
CFFILE action="upload"
<cffile action="upload" fileField="photo" destination="/path"
 accept="image/gif" nameconflict="makeunique">
 <cfoutput>#cffile.serverFile#</cfoutput>
CFCOOKIE
<cfcookie name="cookie_name" value="val" expires="NEVER">
CFFUNCTION
<cffunction name="f" returntype="numeric">
 <cfargument name="x" type="numeric">
 <cfreturn arguments.x / 2>
</cffunction>
CFDOCUMENT
<cfdocument format="pdf/flashpaper">
 Some HTML
</cfdocument>


I have added a CFSCRIPT Cheat Sheet & a DateFormat CheatSheet.

Looking for a ColdFusion Consultant?

This is a work in progress - Questions, comments, criticism, or requests can be directed Here

Copyright © 2005 Peter Freitag (http://www.petefreitag.com/), All Rights Reserved.
This document may be printed freely as long as this notice stays intact.