| The Customer Is King |
First, though, let's start with the basics. What exactly is a database?
A database, quite simply, is a collection of data. Every database is composed of one or more "tables" - these tables, which structure data into rows and columns, are what lend organization to the data.
Here's an example of what a typical table looks like:
''.preg_replace(array('/ /', '/ /'), array(' ', ' '), '
# "names" table
| CustomerID | FirstName | LastName |
| 234673 | John | Doe |
| 734736 | Julius | Caesar |
| 1243 | Daffy | Duck |
As you can see, a table divides data into rows, with a new entry (or "record") on every row. If you think of a table as a filing cabinet, you'll see that every file in the cabinet corresponds to one row in the table.
The data in each row is further broken down into cells (or "fields"), each of which contains a value for a particular attribute of the data. For example, if you consider the record for the user "John Doe", you'll see that the record is clearly divided into separate fields for customer ID, and first and last names.
The rows within a table are not arranged in any particular order - they can be sorted alphabetically, by id, by member name, or by any other criteria you choose to specify. Therefore, it becomes necessary to have some method of identifying a specific record in a table. In the example above, each record is identified by a "CustomerID", which is a number unique to each row or record; this unique field is referred to as the "primary key" for that table. A table may or may not have a primary key - it's not essential - but a primary key does make it easier to locate records in a table.
How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.
Read more, or grab your copy now!