Building a Content Management System with PEAR - The database structure
(Page 2 of 4 )
The application has only three tables, which are of course linked by a foreign key.
The stories table holds all the information about a particular article as well as a link to its creator. It has the following structure:
Field | Description |
sid | Holds the record number. |
title | Stores the title of the article. |
author* | Stores the id of the author. |
story | Stores the body of the article. |
s_date | Stores the date that the article was written and submitted. |
* This field creates a link to the yet-to-be-discussed authors table. This type of field is referred to as the "foreign key."
The authors table stores information about the author. It has the following fields:
Field | Description |
aid* | Stores the ID of the author. |
name | Stores the name of the author. |
* The aid field is an auto generated number that links to the author field that is in the stories table.
Finally, the users table is responsible for holding information about the users of the system. This table is mainly used to authenticate users of the Content Management System. It has the following fields:
Fields | Description |
uid | Stores a unique ID for each user. |
uname | Holds the user's name. |
U pass | Holds the user's password. |
level | Stores the user's access level. |
In the following section, I will show you the SQL for all of the tables above.
Next: Tables >>
More PEAR Articles Articles
More By David Web