"Coldfusion Basics" Vol. 2, Issue 3, p.31
 
LISTING 11: EMPLOY4.CFM Using <CFTABLE> to Create Non-HTML Tables
 
<CFQUERY DATASOURCE="A2Z" NAME="Employees">
SELECT FirstName, LastName, PhoneExtension, EmployeeID
FROM Employees
ORDER BY LastName, FirstName
</CFQUERY>
<HTML>
<HEAD>
<TITLE>Employee List</TITLE>
</HEAD>
<BODY>
<H1>Employees</H1>
<CFTABLE QUERY="Employees" COLHEADERS>
<CFCOL
HEADER="Employee"
TEXT="<AHREF=""empdtl1.cfm?EmployeeID=#EmployeeID#"">#LastName#,
#FirstName#</A>"
>
<CFCOL
HEADER="Extension"
TEXT="Ext. #PhoneExtension#"
>
</CFTABLE>
</BODY>
</HTML>
 
LISTING 12: EMPLOY5.CFM Creating  HTML Tables with <CFTABLE>
 
<CFQUERY DATASOURCE="A2Z" NAME="Employees">
SELECT FirstName, LastName, PhoneExtension, EmployeeID
FROM Employees
ORDER BY LastName, FirstName
</CFQUERY>
<HTML>
<HEAD>
<TITLE>Employee List</TITLE>
</HEAD>
<BODY>
<H1>Employees</H1>
<CFTABLE QUERY="Employees" COLHEADERS HTMLTABLE>
<CFCOL
HEADER="Employee"
TEXT="<AHREF=""empdtl1.cfm?EmployeeID=#EmployeeID#"">#LastName#,
#FirstName#</A>"
>
<CFCOL
HEADER="Extension"
TEXT="Ext. #PhoneExtension#"
>
</CFTABLE>
</BODY>
</HTML>
 
LISTING 13: EMPLOY6.CFM Creating Tables Manually
 
<CFQUERY DATASOURCE="A2Z" NAME="Employees">
SELECT FirstName, LastName, PhoneExtension, EmployeeID
FROM Employees
ORDER BY LastName, FirstName
</CFQUERY>
<HTML>
<HEAD>
<TITLE>Employee List</TITLE>
</HEAD>
<BODY>
<CENTER>
<TABLE BORDER=5>
<TR>
<TH COLSPAN=2>
<H1>Employees</H1>
</TH>
</TR>
<CFOUTPUT QUERY="Employees">
<TR>
<TD>
<AHREF="empdtl1.cfm?EmployeeID=#EmployeeID#">#LastName#, #First-
Name#</A>
</TD>
<TD>
Ext. #PhoneExtension#
</TD>
</TR>
</CFOUTPUT>
</TABLE>
</CENTER>
</BODY>
</HTML>
 
LISTING 14: EMPLOY7.CFM Employee List Grouped by Department
 
<CFQUERY DATASOURCE="A2Z" NAME="Employees">
SELECT DepartmentID, FirstName, LastName, PhoneExtension, EmployeeID
FROM Employees
ORDER BY DepartmentID, LastName, FirstName
</CFQUERY>
<HTML>
<HEAD>
<TITLE>Employee List</TITLE>
</HEAD>
<BODY>
<H1>Employees</H1>
<CFOUTPUT QUERY="Employees" GROUP="DepartmentID">
<H2>Department #DepartmentID#</H2>
<UL>
<CFOUTPUT>
<LI><AHREF="empdtl1.cfm?EmployeeID=#EmployeeID#">
[ic:ccc]#LastName#, #FirstName#</A> - Ext. #PhoneExtension#
</CFOUTPUT>
</UL>
</CFOUTPUT>
</BODY>
</HTML>
 
LISTING 15: HELLO4.CFM Avoiding Variable Name Conflicts
 
<HTML>
<HEAD>
<TITLE>Hello!</TITLE>
</HEAD>
<BODY>
Hello,<BR>
<CFIF IsDefined("URL.name")>
<CFOUTPUT>
The name you entered is<B>#URL.name#</B>
</CFOUTPUT>
<CFELSE>
You did not pass a parameter called NAME
</CFIF>
</BODY>
</HTML>