O'Reilly logo

Learning PHP and MySQL by Jon A. Phillips, Michele E. Davis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Database Basics

We're now going to introduce you to basic database structure so that you have an understanding of databases. Adding MySQL to PHP and combining the applications for your dynamic web site is a great start. But, it helps tremendously to structure your database right. We'll give you a solid understanding of both database design and the language that's used to communicate with the database, SQL. The first step in setting up your database is to design how you'll store your data. Then, you'll learn how to add, view, and change data.

Databases are a repository for information. They excel at managing and manipulating structured information. Structured information is a way to organize related pieces of information, which we discussed previously in our chapters on PHP. The basic types of structured information, which can also be called data structures, include:

  • Files

  • Lists

  • Arrays

  • Records

  • Trees

  • Tables

Each of these basic structures has many variations and allows for different operations to be performed on the data. An easy way to understand this concept is to think of the phone book. It's the most widespread database, and it contains several items of information—name, address, and phone number, as well as each phone subscriber in a particular area. Phone books have evolved, and some people may have bolded names, but for the most part, each entry in the phone book takes the same form.

If you think of the physical hardcopy phone book in similar terms as a database, the phone ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required