Part 2: Server Behaviors in Dreamweaver CS5 with PHP / MySQL

In an earlier  post focused on the first part of Lesson 6 we explored the server behaviors that create a fully function user login system using webpage forms and a MySQL database with user records stored in a table.   Now we will explore how to work with MySQL database data forms for reading creating and updating database records.

The Recordset Server Behavior

A Recordset is essentially a SQL query (a SELECT statement) which returns rows & columns of data from the database.   The Recordset interface has a SIMPLE and ADVANCED views.   A Recordset is only a definition of the query and is presented in the Bindings Panel.   By binding data elements to the page, you create the PHP code that executes the SQL statement represented by the Recordset object.

You need to designate element (TR) containing the bound data elements as a Repeat Region using the Server Behavior of the same name.

The Update Record Server Behavior

The ‘hook’ to query and then either update or delete records is the primary key.   You don’t want to display the primary key, so bind it to a hidden field (right in the Property Inspector).

The Show Region Server Behavior

Conditional server behaviors to deal with how to display elements depending on whether the recordset contains records and what page of recordset results is currently displayed.

1 comment for “Part 2: Server Behaviors in Dreamweaver CS5 with PHP / MySQL

Comments are closed.