Accessibility

Table of Contents

Creating an event registration application in PHP – Part 2: Building the back end

Getting started

Before you begin building the application, take a moment to examine the database tables that are employed and ensure that the database connection is properly set up in Dreamweaver.

Note: It's a good idea to have your dynamic PHP site already set-up at this point and have unpacked the sample files into the local root folder.

Understanding the database schema

The database that accompanies this article is a relatively simple one with 3 tables: presentations, registrants and admin.

The first table, admin, is by far the smallest, but it is vital for any administrative application. The admin table contains the username and password (see Figure 1) for authorized administrators, which is verified at log in.

The admin database schema

Figure 1. The admin database schema

As described in this article's companion tutorial, Creating an event registration application in PHP , the presentations table maintains information for the various sessions held during the event. The table includes data columns for storing the presentation's name, a short description, and a longer description. There are also columns for the date and time of the talk, its duration and the day of the event (1, 2, 3, and so on) on which the presentation is given. Speaker details, such as name and file name for a picture, round out the table schema.

In comparison, the registrants table has far fewer data columns. Only columns for the registrant's first name, last name, e-mail address, and event name are included. You could—and probably would—require a much more robust set of data columns for an actual application, but this structure should give you a good sense of the type of information you can gather.

The SQL file for the Subscriptions database is included in the sample files download. You can recreate it on your test server through any number of utilities, including phpMyAdmin, MySQL Control Center or MySQL Administrator.

Making the database connection

After you've established your database, it's time to create a connection to it in Dreamweaver. To do so, follow these steps:

  1. Choose Window > Databases.
  2. Click Add (+)  and choose MySQL Connection from the menu.
  3. When the MySQL Connection dialog box appears, do the following (see Figure 2):

    • Enter the name of your new connection in the Connection name field (for example, connEventReg).
    • Enter an IP address or MySQL server name in the MySQL server field. If you're working with a local development system, enter localhost.
    • Insert your user name and password in the appropriate fields.
    • Click Select to display the available databases; choose the desired one from the list.

      The Dreamweaver database connection

      Figure 2. The Dreamweaver database connection

  4. Click Test to verify the connection and then OK if the connection is successful.

With your PHP dynamic site, MySQL database, and Dreamweaver connection all established, you're ready to build the first page of the application.