Dynamically Populating a Table
The recordset is now available to the page, and you can now output it. The recordset is eventually going to go into a table, but first you'll need to prepare the page with some stati216.
1. | Open dante_admin.cfm. Replace the placeholder "Body text goes here" with The following students are enrolled in the class . Press Enter or Return twice, and then type Return to the Dante site home page . Link the word Return to index.cfm. |
You'll put the table in the blank line between the two sentences you just entered.[View full size image]

2. | Position the insertion point in the blank line. From the Application category of the Insert bar, choose Dynamic Data: Dynamic Table. |
The Application category of the Insert bar contains many common dynamic Web application components. The Dynamic Table is particularly convenient. You tell Dreamweaver which recordset to use, and it automatically outputs all of the records inside the table.[View full size image]

3. | In the Dynamic Table dialog, verify that rs_GetUsers is selected and click the All records radio button. Leave the remaining settings at their defaults and click OK. |


4. | From the main menu, choose View > Live Data. |
The table is populated with live database data. It has a yellow background, which indicates that the data can be edited. (This yellow background won't appear in the actual page; it is just a Dreamweaver visual aid.)[View full size image]

5. | In the first row of the table, replace username with Email Address ; firstName with First Name ; and lastName with Last Name . Drag to select each new heading, and use the Property inspector to apply Bold . |
This step is mainly cosmetic; no special functionality is added on the server.

6. | Save and Put the page on the remote server. Click in the Document window and press F12 (Windows) or Option+F12 (Macintosh) to test the page. |
The page opens in a browser, and the data appears as expected.
<a href="target_page.cfm">Clickable link text </a>Creating an email link is slightly different:
<a >Clickable link text </a>As you can see, email links are always prefaced with mailto:.Lesson 13, ColdFusion outputs dynamic data using the <cfoutput> tag. Return to dante_admin.cfm and toggle Live Data back off by choosing View > Live Data. If you look in the code for the table, you'll see that the email address is coded as follows:
<td>#rs_GetUsers.username#</td>The <td> tags simply indicate a table cell. Remember, everything inside the pound signs (##) is a variable or expression that ColdFusion should evaluate. The code rs_GetUsers.username means the username variable that belongs to rs_GetUsers (the dot between GetUsers and username, which is called an access operator, indicates ownership; the item on the right belongs to the item on the left).Now you have to put all that together. As you've probably anticipated, you'll need the following code:
<td><a >#rs_GetUsers.username#</a></td>
7. | In code view, replace the line <td>#rs_GetUsers.username#</td> with the following line of code: <td><a >#rs_GetUsers.username#</a></td> |
ColdFusion generates an email link for each user in the database.[View full size image]

8. | Save and upload the file. Test it by pressing F12 (Windows) or Option+F12 (Macintosh). |
This time, all the email addresses should be hyperlinked. When you click one, your email editor should appear with a new message open, with the selected student already in the To line. (Don't bother sending an email message to any of these recipients, as they're all fake.)