Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1

of the tables. They will also have INSERT privileges on the Orders table so they can send gifts. Table
21.5 shows a summary of the privileges.
Table 21.5 Summary of the Meet_A_Geek User Privileges


User Table Privilege

New Customer
Customers INSERT
Only

All Customers

Customers (^) UPDATE,
SELECT
(^) Orders INSERT^
(^) Ads INSERT,
UPDATE,
DELETE
Staff All tables


FULL

Create the Web Pages and Scripts


You have now entered the fourth phase of the creation process—the actual building of the database. This is
the longest phase of the process but also the most rewarding. You get to actually build what you have
designed. By looking at the flow chart, it can be determined that there are five scripts that need to be written
that access the database for one reason or another. When creating a Web site like this, you normally would
pick one kind of technology and stick with it. For example, you wouldn't decide to use Perl CGI scripts for
some things and Active Server Pages for others. The technologies overlap each other. It just wouldn't make
sense. Perl Scripts are chosen using the DBI to demonstrate how easy it is to use with MySQL.


Building the Web Page


The first step is to create a Web page that will send the data you need to your Perl Script. You will then
create the script that adds a new customer to the database. You'll be using a Perl Script to accomplish this
task. Other members of your team are responsible for that part of the project. They have been hard at work
and have come up with the Web page shown in Figure 21.3.


Figure 21.3 The Meet-A-Geek New Customer Application form.
Listing 21.1 shows the code behind the NewCustomer.html Web page.
Listing 21.1 Adding New Customers to the Database

Free download pdf