Specifications
grant select, insert, update, delete
on book_sc.*
to book_sc@localhost identified by ‘password’;
Although nothing was wrong with the original Book-O-Rama interface, we have a few other
requirements now that we are going to make it available online.
The changes we have made to the original database are as follows:
• The addition of more address fields for customers—this is more important now that we
are building a more realistic application.
• The addition of a shipping address to an order. A customer’s contact address might not
be the same as the shipping address, particularly if she is using the site to buy a gift.
• The addition of a categories table and a catid to books table. Sorting books into cate-
gories will make the site easier to browse.
• The addition of item_price to the order_items table to recognize the fact that an item’s
price might change. We want to know how much it cost when the customer ordered it.
• The addition of an admin table to store administrator login and password details.
• The removal of the reviews table—you could add reviews as an extension to this project.
Instead, each book has a description field which will contain a brief blurb about the
book.
To set this database up on your system, run the book_sc.sql script through MySQL as the root
user, as follows:
mysql -u root -p < book_sc.sql
(You will need to supply your root password.)
Beforehand, you should change the password for the book_sc user to something better than
‘password’.
We have also included a file of sample data. This is called
populate.sql. You can put the sam-
ple data into the database by running it through MySQL in this same way.
Implementing the Online Catalog
Three catalog scripts are in this application: the main page, the category page, and the book
details page.
Building Practical PHP and MySQL Projects
P
ART V
548
LISTING 25.1 Continued
31 7842 CH25 3/6/01 3:38 PM Page 548










