Enhancing Websites with PHP

Working with MySQL

You may be beginning to appreciate that PHP by itself is a very powerful language. However, at the heart of a site’s dynamic functionality is its backend database. MySQL is the most common database management system (DBMS) in use because it seamlessly integrates with PHP. It is also included in your WAMP or MAMP server package as represented by the M. Other DBMS’s you may be familiar with include Microsoft Access or Oracle’s or Microsoft’s SQL Server.

Databases provide efficient storage and retrieval of information making it possible for you to deliver fresh or custom content to your site visitors on the fly. Databases can also control who has access to the data. You can create users with different privileges to view or update the data in your database. Some users may be able to access some data, while others may not, based upon their credentials. You may also authorize users to be able to build and maintain the database, and/or restrict how much they can modify.The data in a database is organized into one or more tables. Each table is a collection of records, such as users, customers, contacts, or articles and each has a set of field definitions. These definitions tell what kind of data will be stored. For example, a table consisting of site users may have fields for user id, first name, last name, and email address.In this unit, you will learn how to create your database and its tables and define the fields in each table using phpMyAdmin, the interface provided in your WAMP or MAMP package. You access phpMyAdmin by clicking the applicable menu link in your package or from your browser at the address http://localhost/phpMyAdmin/ on Windows or http://localhost:8888/phpMyAdmin/ on Mac. Remember, it is case sensitive and your servers must be running for the address to be available.

print