Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Display the Latest Travel Destination

Display the Latest Travel Destination

The homepage of the site will display the latest travel destination entered in the database. To achieve this you must:

  1. Create a recordset that retrieves the destinations.
  2. Display a travel destination on the homepage.

Create the Recordset

A recordset is a set of records from a database tableā€”in this particular case, a set of vacation destinations. In Dreamweaver, you can either create a recordset using its dialog box, or enter the SQL code yourself.

To create the recordset that retrieves the latest travel destination from the corresponding table, follow the next steps:

  1. Open the index.php file.
  2. In the Application tab, click the Bindings tab to display it.

    Click the Bindings title to open the tab

    Figure 10. Click the Bindings title to open the tab

  3. Click the Plus (+) button and select the Recordset (Query) option.

    Create a new recordset option

    Figure 11. Create a new recordset option

  4. The basic recordset dialog box displays. Fill in the options as follows:

    1. In the Name text box, enter rsDestination (the recordset name).
    2. In the Connection pop-up menu, select the connTravel database connection created at the beginning of the tutorial.
    3. The Table pop-up will display the only table in the database: destination_dst. Select it.
    4. In the Sort pop-up menu select date_dst. For the method select Descending.

    Configure the recordset properties

    Figure 12. Configure the recordset properties

  5. Click OK to close the dialog box and create the recordset.

The newly created recordset displays in the Bindings tab. Expand it to see the columns it retrieves:

Expand the recordset to see the columns it retrieves

Figure 13. Expand the recordset to see the columns it retrieves

Now that you created the recordset, you can move on and display information from it on the page.

Display Dynamic Data

The description text displays in the center column of the template page, replacing the bogus content. To make space for the dynamic field, follow the next steps:

  1. Open the index.php file.
  2. Delete the content from the center column: select it (including the title) and press Delete. You should then have a layout as in figure 15.

    Empty table after removing content

    Figure 14. Empty table after removing content

  3. Click inside one of the table cells in the center and click the Table tag in the Tag Selector.

    Select the table containing the TD

    Figure 15. Select the table containing the TD

  4. Using the Property inspector, set the table width to 650 pixels.

    Set the table width using the Property inspector controls

    Figure 16. Set the table width using the Property inspector controls

  5. Drag the name_dst field from the Bindings tab into the first table cell:

    Display the travel destination name

    Figure 17. Display the travel destination name

  6. To display the description, drag the corresponding recordset field from the Bindings tab into the second table row. The result is like figure 17:

    Dynamic text in the center column

    Figure 18. Dynamic text in the center column

Save the page and press F12 to preview it. The default entry displays:

The description displays on the page

Figure 19. The description displays on the page

Now that display is out of the way, you can move on and create the page that allows editing database information.

Comments