Accessibility

Table of Contents

Setting up a PHP development environment for Dreamweaver

Connect to the database

This section describes how to create a connection in Dreamweaver to the sample feedback database.

  1. In Dreamweaver, create a new PHP page in your site and save it as index.php.
  2. In the Databases panel (select Window > Databases), click the Plus (+) button on the panel and select MySQL Connection from the pop-up menu.

    The MySQL Connection dialog box appears.

  3. Enter connTest as the connection name.
  4. In the MySQL Server field, enter localhost.
  5. In the User name field, enter adctest.
  6. Type the password you chose for the the feedback_user account in the Password field.
  7. In the Database field, enter adc_demo.

    Note that you don't need to precede the underscore with a backslash here. It was inserted by phpMyAdmin in the previous section (see Figure 11) only because phpMyAdmin uses a query that permits wildcard characters.

  8. Click Test.

    Dreamweaver attempts to connect to the database. If the connection fails, do the following:

    • Double-check the server name, user name, and password.
    • Check the settings for the folder Dreamweaver uses to process dynamic pages (see Specify a testing server for Dreamweaver).
    • Verify that the web and MySQL servers are both running.
    • Temporarily disable any firewall or security program. If the connection works, you need to configure the security program to permit communication between Dreamweaver and MySQL.
  9. Click OK. The new connection appears in the Databases panel.
  10. Expand the connTest connection, and then expand the Tables branch. You'll see the tables in the database (see Figure 13).

    The Databases panel showing the tables

    Figure 13. The Databases panel showing the tables.

  11. Select File > Save to save your changes.

Congratulations! Your PHP development environment and site is now set up and you are ready to start developing PHP web applications in Dreamweaver.

Where to go from here

This tutorial has shown you how to set up a PHP development environment, define a PHP site, and connect to a MySQL database. Defining the site and testing server, and establishing a MySQL connection are fundamental to developing PHP web applications in Dreamweaver. You are now ready to start experimenting with Dreamweaver server behaviors to select, insert, update, and delete database content in a website.

For more articles and tutorials on developing for PHP using Dreamweaver, visit the Web application development page in the Dreamweaver Developer Center. If you're new to building PHP applications in Dreamweaver, step through the tutorial series Creating your first dynamic site in Dreamweaver.