Creating the master page (PHP)

This post describes how to create a master page that lists database records. You can use a dynamic table to list the records on a PHP page.

Before you start, make sure you define a database connection for the site.

To create a master page:

1. In Dreamweaver, create a new PHP page.

Select File > New > Dynamic, select PHP, and click Create.

A blank PHP page opens in Dreamweaver.

2. Define a recordset for the page.

In the Bindings panel (Window > Bindings), click the Plus (+) button, select Recordset (Query), and complete the Recordset dialog box. For more information, click the Help button on the dialog box. If you want to write your own SQL statement, click the Advanced button to open the advanced Recordset dialog box.

Make sure the recordset contains all the table columns you need to create your dynamic table. The recordset must also include the table column containing the unique key of each record--that is, the record ID column. In the following example, the CODE column contains information that uniquely identifies each record.

recordsed

Typically, the recordset on the master page extracts a few columns from a database table while the recordset on the detail page extracts more columns from the same table to provide the extra detail.

The recordset can be defined by the user at runtime.

3. Insert a dynamic table to display the records on the page.

Place the insertion point where you want the dynamic table to appear on the page, and select Insert > Application Objects > Dynamic Data > Dynamic Table.

The Dynamic Table dialog box appears.

dynamic table

4. Complete the Dynamic Table dialog box and click OK.

Dreamweaver inserts a dynamic table on the page.

If you need help completing the Dynamic Table dialog box, click the Help button on the dialog box.

5. If you want, delete the dynamic table column containing the record IDs.

If you don’t want to show record IDs to users, you can delete the column from the dynamic table. Click anywhere on the page to move the focus to the page. Move the pointer near the top of the column in the dynamic table until the column cells are outlined in red, then click to select the table column. Press Delete to delete the column from the table.