Dreamweaver MX, MySQL, and PHP

As difficult as the choice of which database system to use for your web application is, choosing the right development language to access that database from the web can be even more trying. Fortunately, if you selected MySQL for your database, Dreamweaver MX gives you the power of PHP (Hypertext Preprocessor) for development against that MySQL system out of the box. Although it is possible to use other web development languages with MySQL and it is also possible to use PHP with other database systems, the combination of the two within Dreamweaver MX is quite powerful.

Using Dreamweaver MX, you can take care of the connection from your web application to your MySQL database quickly. In the same way that you start Dreamweaver MX applications with other database systems, you will need to do the following:

  1. Create the site.

  2. Set the document type.

  3. Configure the test server.

  4. Establish the Dreamweaver MX database connection.

Note 

Selecting PHP as the document type lets Dreamweaver MX know that you intend to use MySQL as your database platform because that is the only database directly supported within Dreamweaver MX for PHP web application development at this time.

Here, we are concerned with step 4. The basic information required for establishing the connection to your MySQL server instance is as follows:

  • Connection name

  • MySQL server

  • Username

  • Password

  • Database

Given this information, Dreamweaver MX constructs the following code to handle your web application's interaction with the MySQL server.

<?php  # FileName="Connection_php_mysql.htm"  # Type="MYSQL" # HTTP="true" $hostname_WebProjDB = "localhost";  $database_WebProjDB = "WebDB";  $username_WebProjDB = "MyUser";  $password_WebProjDB = "MyPass";  $WebProjDB = mysql_pconnect($hostname_WebProjDB,    $username_WebProjDB, $password_WebProjDB) or die(mysql_error());  ?>

Note 

Note See Chapter 10 for information about working with the MySQL Connection dialog box in Dreamweaver MX.



Mastering Dreamweaver MX Databases
Mastering Dreamweaver MX Databases
ISBN: 078214148X
EAN: 2147483647
Year: 2002
Pages: 214

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net