The code below formats Emplist query in a table. The query was defined previously on that same page.
... <TABLE > <TR> <TH>First Name</TH> <TH>Last Name</TH> <TH>Start Date</TH> <TH>Salary</TH> <TH>Contract?</TH></TR><CFOUTPUT QUERY="EmpList"> <TR> <TD>#FirstName#</TD> <TD>#LastName#</TD> <TD>#StartDate#</TD> <TD>#Salary#</TD> <TD>#Contract#</TD> </TR> </CFOUTPUT> </TABLE> ...
One table will be generated for the page display.
One row of table headers will be generated for the page display.
Surround each column reference with a table data tag.
One table row will be generated for each row returned for the query.
![]() |
To generate a table with query results: |
EmpList.cfm
in HomeSite.95%
.<TH ALIGN ="Left">First Name</TH> <TH ALIGN ="Left">Last Name</TH> <TH ALIGN ="Left">Start Date</TH> <TH ALIGN ="Left">Salary</TH> <TH ALIGN ="Left">Contract?</TH>
<TD>#FirstName#</TD> <TD>#LastName#</TD> <TD> #StartDate#</TD> <TD>#Salary#</TD> <TD>#Contract#</TD>
Your table code should look like this:
<TABLE> <TR> <TH ALIGN ="Left">First Name</TH> <TH ALIGN ="Left">Last Name</TH> <TH ALIGN ="Left">Start Date</TH> <TH ALIGN ="Left">Salary</TH> <TH ALIGN ="Left">Contract?</TH> </TR> <CFOUTPUT QUERY="EmpList"> <TR> <TD>#FirstName#</TD> <TD>#LastName#</TD> <TD>#StartDate#</TD> <TD>#Salary#</TD> <TD>#Contract#</TD> </TR> </CFOUTPUT> </TABLE>
The employee data appears in a table.
Click here to see how the page should look at this time.
Click here to see the code behind the scenes.
![]() |
Note: | The navigation links will not work at this time. |