While Dreamweaver automates the process of querying the database, it is important to make some manual queries to get a better idea of what the automation is actually doing. The following are the steps to querying a database.
Server Address: The address to the web server housing the MySQL database. This is typically localhost, but cana be more specific depening on the web server configuration.
Database Select: MySQL supports multiple databases, so it is important to declare which database you are selecting.
Username: A user must be created with privileges to manage the datasbase. MySQL has a database which manages this, you may have seen it in PHPMyAdmin. By default in MAMP and WAMP this user is root, and of course you can add your own users and passwords to increase security.
Password: The password that accompanies the DBA user above.
In this step we use mysql_pconnect to establish a persistant connection to the MySQL server. By assigning it to a variable, we can then reference the connection to perform queries. The mysql_pconnect takes three perameters/arguments; 1) Server Address, 2) DBA username, and 3) DBA password. We can also add a MySQL Error report if the connection fails by writing it as follows:
mysql_pconnect(serveraddress, username, password) or trigger_error(mysql_error(),E_USER_ERROR);