This article introduces the concept of a database and other important components and definitions for the web developer. This material will be useful for novice web programmers to organize and systematize their knowledge.
Defining the Term Database
Databases can be used to store products, details of customers, records of members of a society or a club, and much more. They can store names, passwords, addresses, e-mail addresses, registration dates, blog entries, and telephone numbers. Databases can be regarded as folders containing tables of data. The table of data, like all tables, has columns and rows; however, the rows in database tables are called records. A typical database table is shown in Table 1.
Table 1. A typical database
Defining Developer, Administrator, and User
The term “developer" (a.k.a. “webmaster") means the person who designs and produces the database; he or she will integrate the database into a web site. Sometimes I will use the term “webmaster" or “web designer" When I do, it usually means the same thing as “developer" The words “administrator" and “membership secretary" have the same meaning in some of the articles's tutorials, which are based on building a database for a club. The word “administrator" means the person responsible for monitoring and maintaining the content of the database tables. Clearly, one person can be both a developer and an administrator. However, most developers will maintain the structure of a database but will not want the hassle of amending and deleting records; that should be the role of an administrator (a club or society's membership secretary, say).
The “user" is any member of the general public viewing and possibly interacting with a web site database. For security reasons, users have extremely limited access to the database; however, they will be allowed to register for membership, log in to a special section, or change their password.
Caution The organization commissioning a database must conform to the Data Protection Act for the territory in which the database is developed. This is especially important if that data is going to be used for profit. Conformance usually means obtaining a license. In addition the developer and administrator must normally sign a document confirming that they will never disclose the details of persons recorded in the database. In the UK, the Information Commissioner’s Office (ICO) requires an annual license fee based on the revenues of the organization that owns the database. Currently, there is no equivalent in the USA, but privacy laws differ between states. It is essential that you understand and obey the data-protection laws for your client’s territory.However, you do not have to apply for a license if you use fictitious data in a database for the purpose of learning and experimenting with databases.
Defining Interactive Web Sites
Interactive web sites are often called dynamic web sites; however, I prefer to use the word interactive because dynamic can signify so many things. For instance, it can mean moving, powerful, eye catching, flashy, exciting. To a beginner, none of those meanings define a web page that interacts with a user.
Dynamic is so often used to mean exciting, but there is little excitement to be seen in an interactive registration form. Dynamic is also a musical term meaning changes or variations in loudness or speed. If dynamic can refer to change, why were dynamic templates designed to provide consistency from one web page to another? The term interactive has one clear meaning and will be used from now on in this book.
MySQL (with PHP) allows users and administrators to interact with a database using web site pages. For instance, users can register as members of an organization via a registration page on a web site. Users will be able to supply their personal data for the membership tables. MySQL then enters the users' input into the administrator's tables automatically; this lightens the workload of the administrator. The web site's registration page can be programmed to filter users' data input and verify it. From an interactive page, users may even be allowed to update their own records in a database.
Interactivity means that the administrator's workload is greatly reduced, but not completely. For instance, if the database is for a bookshop, the administrator will still have to enter any new titles and prices. On the other hand, an interactive database can be programmed to alert the administrator when the stock of a certain book needs replenishing.
Only Use MySQL for Interactive Database Tables
A non-interactive database table means that only the administrator can enter or amend the table's data.
A non-interactive database would be more easily created and administered using a spreadsheet or database program, such as Microsoft Excel or Microsoft Access. Web site users cannot interact with such a database. Employing MySQL to create a non-interactive (static) version of the database would be like using a sledgehammer to crack a nut. A static database such as Excel or Access has one advantage, it cannot be easily accessed online by hackers; however, it has to be maintained by an administrator and is very labor intensive. Website users have no input, and they cannot search or update their data.
Using MySQL for a non-interactive version would not reduce the workload of an administrator, he would have to enter all the members' data and verify that the data is genuine.
Note A few interactive web pages do not need a database in order to function. For instance, a Contact Us form can be regarded as interactive because it takes a user’s input and transmits it to the web site’s owner in the form of an e-mail; this can be achieved easily without a database. In this book, the term “interactive” always means the user can interact with a database.