So now that you’ve done some really cool stuff with PHP in Chapter 2, such as using includes and functions, it’s time to make your site truly dynamic and show users some real data. You may or may not have had experience with databases, so we’ll take a look at what MySQL is and how PHP can tap into the data. We will also show you what a MySQL database looks like in terms of the different tables and fields and give you some quickie shortcuts to make your life much easier (you can thank us later for those).
By the end of this chapter, you will be able to:
❑ Understand a MySQL database
❑ View data contained in the MySQL database
❑ Connect to the database from your Web site
❑ Pull specific information out of the database, right from your Web site
❑ Use third-party software to easily manage tables
❑ Use the source Web site to troubleshoot problems you may encounter
Although some of this information is expanded upon in later chapters, this chapter lays the groundwork for more complex issues.
Overview of MySQL Structure and Syntax
MySQL is a relational database system, which basically means that it can store bits of information in separate areas and link those areas together. You can store virtually anything in a database: the contents of an address book, a product catalog, or even a wish list of things you want for your birthday. In the sites you create as you work through this book, you are storing information pertinent to a movie review site (such as movie titles and years of release) and comic book fan information (such as a list of authentic users/comic book fans and their passwords).
MySQL commands can be issued through the command prompt, as you did in Chapter 1 when you were installing it and granting permissions to users, or through PHP. We primarily use PHP to issue commands in this book, and we will discuss more about this shortly.
MySQL Structure
Because MySQL is a relational database management system, it