Web Database Applications with PHP and MySQL: A Book Review

by Phil Hughes

Title: Web Database Applications with PHP and MySQLAuthor: Hugh E. Williams and David LanePublisher: O'Reilly & AssociatesISBN: 0596000413Price: $44.95

This book is subtitled Building Effective Database-Driven Web Sites, and I feel it is right on target. This is not a book for someone unfamiliar with programming, but if you have a programming background, the book will get you thinking about web design (system design, not graphic design), as well as PHP and MySQL programming.

Additionally, if you have dabbled with PHP and/or MySQL and are now ready to update your system design skills and move onto a larger project, this is a good book to move you along.

The book is logically organized into four parts: learning the tools, developing the application logic, a case study and five supporting appendices. The first part has chapters that cover the traditional three-tier architecture used in web database applications. It is followed by a chapter on PHP and a chapter on MySQL and SQL in general. There is enough information in the PHP chapter to make a programmer pretty comfortable with PHP. The database chapter is primarily focused on MySQL, but it also touches on other SQL databases.

In the next part of the book, these three tools--the three-tier approach, PHP and MySQL--are combined to start building an application. Chapter four is about queries, chapter five covers user-driven queries and chapter six discusses writing to databases. Throughout this part an on-line wine store is used as a practical example. When you get through this section you should be fairly comfortable developing a basic application.

Chapters seven through nine then add all the stuff you didn't want to think about, including validation with PHP on the server and JavaScript on the client. The next thing you didn't want to think about is sessions, which are covered well in chapter eight. The advantages and disadvantages of each method is presented, and illustrations are included where it makes sense to have them.

The next logical step is authentication and security, which are the subjects of the following chapter. How authentication works is discussed, with a couple of illustrations supplied to help clarify things. The practice of authentication and dealing with security is then addressed.

The third part of this book finishes up the wine store example, covering things like the customer management code, a shopping cart, order handling and shipping. The last chapter, appropriately titled "Related Topics", covers all the stuff you might have left out, such as automatic housekeeping, templates, searching and browsing. The template section uses the XTemplate library.

The five appendices cover installation of MySQL, Apache and PHP, protocols, the relational database model, session management in the database tier (as opposed to session management in PHP, as was previously covered) and resources. The resources appendix is divided into client-, middle- and database-tier resources, plus a short list of security and cryptography resources.

For the right audience, this book puts a lot of information together in one place, making it possible for the authors to address all the important interactions between these various elements.

The bad parts are some minor misstatements in the introductory text and the lack of serious coverage of object-oriented programming. While PHP isn't a serious object-oriented language, seeing where OOP makes sense in the process would have been a plus. The book has about four pages on what OOP is in PHP, but it is not used in the examples.

All in all, this is a very good book. I have lots of books on PHP and databases and have found myself looking in multiple books in order to synthesize an answer. In many cases I can see the complete answer in this one book. If you don't need computer concepts and language hand-holding but want to do a database-driven web application right, this book is well worth the price.

Phil Hughes is the publisher of Linux Journal.

email: phil@ssc.com

Load Disqus comments

Firstwave Cloud