0.3. How This Book Is Organized
There are 13 chapters and 5 appendixes in this book. Chapter 1 to Chapter 3
introduce web database applications, PHP, MySQL, and SQL:
- Chapter 1
Discusses the three-tier architecture commonly used in web database
applications and in those that we discuss in this book. We introduce
each of the three tiers and the features of each, and we introduce
the software tools that we use. We also briefly introduce web
protocols. The chapter concludes with an introduction to our case
study example, Hugh and Dave's Online Wines. We
discuss the components of the winestore, the system requirements, and
where in the book the techniques to develop each component are
- Chapter 2
Introduces the PHP scripting language. It covers programming in PHP
and discusses the basic programming constructs, variables, types,
functions, techniques, and common sources of bugs. We include many
short code examples to illustrate how to program with PHP.
- Chapter 3
Introduces the MySQL DBMS and how to interact with it using the
database query language SQL. Using examples from the online
winestore, we introduce the SQL commands for creating, deleting, and
updating data and databases. We also present a longer, example-driven
section on querying the online winestore. The chapter concludes with
discussion of advanced topics, including MySQL database tuning and
Chapter 4 to Chapter 9 cover the principles and practice of developing web
database application logic.
- Chapter 4
Introduces the basics of connecting to the MySQL DBMS with PHP. We
explain the querying process used in most interactions with the DBMS
and present examples that use most of the PHP MySQL library
functions. We also show how results from database queries can be
formatted as HTML for delivery in a web browser. The chapter is
supported by the online winestore case study example, which shows how
to build a moderately complex querying module.
- Chapter 5
Continues the principles and practice of querying web databases. Here
we focus on user-driven querying, in which the user provides
parameters to the querying process. We show how data is encoded, sent
in requests from a web browser to a web server, and decoded for
processing in PHP. We discuss the security implications in processing
user data and show steps to secure interactive querying systems. Our
discussion is supported by a user-driven querying example with
results that can be browsed page by page.
- Chapter 6
Covers writing data to web databases. There are several reasons why
writing data is different from reading it. For example, reloading or
printing a page from a web browser can cause data to be written to a
database more than once. Multiple users accessing the same database
introduces other problems, such as data unexpectedly being changed by
one user while it's being read by another. We
discuss how to solve problems related to the nature of the Web and
multiple users. We illustrate the principles with an example that
adds and edits customer details in the online winestore.
- Chapter 7
This chapter is related to Chapter 6 and presents
the principles and techniques for user-input validation. We introduce
validation models and reporting methods that work in web database
applications and show how these are implemented using PHP and
- Chapter 8
Covers the principles of adding session management to web database
applications. Session management allows the interactions between a
user and the application to be related so that, for example, a user
can log in and log out of an application and be guided through a
series of steps in a process. We show how PHP manages sessions and
illustrate the techniques with a case study of managing error
feedback to users who are joining as customers of the winestore.
- Chapter 9
Presents topics in web security. We show how PHP can be used for
basic authentication, how databases can manage many users, and how
communications can be secured with the network-level secure sockets
layer. Our case study is the login and logout process for the online
winestore. This extends our discussion of session management in Chapter 8.
Chapter 10 to Chapter 13 present and outline the completed
winestore case study. The outlines aren't
comprehensive: we assume you have completed Chapter 4 to Chapter 9 and
understand the principles of developing web database applications. We
recommend that you view, edit, and use the winestore PHP scripts
while reading Chapter 10 through Chapter 13.
- Chapter 10
Presents the code for customer management in the winestore, as well
as the general-purpose functions that are used throughout the
application. The code presented is based on the examples developed
throughout Chapter 4 to Chapter 8. We present the scripts for collecting,
validating, and modifying customer details. We also include the code
for the user login and logout processes based on the material
presented in Chapter 9.
- Chapter 11
Presents the code for the shopping cart at the winestore. The
shopping cart is stored in a database, and each
user's cart is tracked using the session techniques
from Chapter 8. The cart module allows a user to
view her cart, add items to the cart, update item quantities, delete
items, and empty the cart.
- Chapter 12
Presents the code for the ordering and shipping modules of the
winestore. The ordering process shows how the complex
database-processing techniques discussed in Chapter 3 and Chapter 6 are used
to convert a shopping cart into a customer order. We also show how
email confirmations of the order are sent to the user, and an order
confirmation is presented as an HTML page.
- Chapter 13
Concludes the case study examples and presents related web database
topics. We present the complete searching and browsing winestore
module based on the techniques discussed in Chapter 5. We also discuss automating queries and using
templates to separate script code from HTML markup.
There are five appendixes in this book:
- Appendix A
A concise guide to installing the Apache web server, PHP, and MySQL
under the Linux operating system; includes resource pointers to more
detailed installation guides for Linux and other operating systems.
- Appendix B
Builds on Chapter 1 and describes the workings of
the Web in greater detail.
- Appendix C
Contains a case study that models the system requirements for the
winestore using entity-relationship database modeling. It shows how
this model can be converted to a design. It also details the SQL
commands used to create the winestore database.
- Appendix D
An extension of Chapter 8, this appendix shows how
the default PHP method for session handling can be moved to the more
scalable underlying database tier.
- Appendix E
Lists useful resources, including web sites and books containing more
information on the topics presented throughout this book.
Copyright © 2003 O'Reilly & Associates. All rights reserved.