Viewing the Database Tables 243
LISTING 14.3
Cold Fusion Code to Display a Database Table Using Attribute Logical Names
<!--- strTable has already been defined and contains the name
of the table to be displayed --->
<CFQUERY NAME="GetCols">
SELECT * FROM COL_COLUMN_M
WHERE TAB_PHYSNAME_T = ‘#strTable#’
ORDER BY COL_DISPLAYSEQ_N
</CFQUERY>
<table>
<!--- First display the column headers --->
<tr>
<CFLOOP QUERY="GetCols">
<td><CFOUTPUT>#GetCols.COL_ATTLOGNAME_T#</CFOUTPUT></td>
</CFLOOP>
</tr>
<!--- Get the data to be displayed --->
<CFQUERY NAME="GetData">
SELECT * FROM #strTable#
</CFQUERY>
<!--- Loop through the data one record at a time --->
<CFLOOP QUERY="GetData">
<tr>
<!--- For each record get the order of physical names from the
GetCols query—so they match the ...