|One of the greatest features of PHP is how well it works with databases. But many people are intimidated when they begin working with databases. However a database is really just a bunch of data stored in a logical order. You can store any type of data in a database. You can store information about your business customers or the scores for your bowling league. But how do you keep your customer data separate from your bowling scores? |
Databases are made up of a bunch of tables that contain the information you wish to store in your database. You can have as many tables as you want in your database. Each table will contain the information about a different topic. So you can store your customer information in one table and the bowling scores in another table.
Let's say you want to store the following information about each of your customers.
Let's put this information into a table.
As you can see, each customer's information is all on one line in the table and the information fits nicely into individual columns in the table. This makes it easy to access just certain information about your customers such as just their zip codes or just their names.
Next we need a way to identify the information stored in each of these columns in our table. So let's give each column a name.
Let's add these column names into the table.
That's the basic idea of a database. You would have a column, called a field, for each individual piece of information you want to access such as zip codes or names. Each customer's information is all on one line in the table, called a record, so it is easy to match the information to the customer. And there is a different table for each individual topic, customers or bowling scores.