MySQL/PHP Book Review

Motivation: This is a book about getting the most out of MySQL with PHP

What is a book about Web Application Development doing in the SQL section of the tutorials ? Yeah, the book has the obligatory chapter on SQL and the MySQL databases .. ohh so it has two chapters... 5 chapters. And not only that, entwined in every chapter are references to PHP and web application development design tricks and traps. These are so very useful that it became evident that this book was really about Web Database Application Development with PHP and MySQL - exactly as the title says, that is what authors Hugh Williams and David Lane have delivered.

So then the problem became what set of tutorials should this book be classified under and going against the stream - we decided to put it into the SQL category because the book really shows how well integrated a database, MySQL, can be to the development language - PHP.

But the authors take this one step further and devote most of the development examples to PEAR - a database independent library of API calls that works very well with MySQL but also can be used with SQLite or Oracle as well. In fact, that is the emphasis in this tome - how to get the features of the database lined up well with the features of the application scripting language - PHP.

The authors make a good case for using PHP 5 which was in Release Candidate beta when the book was written but is now officially out the door. The authors make three compelling arguments to upgrade to PHP 5. First, the object programming is solidified and made more manageable. Second, the performance of the PHP is enhanced, no small part due to the object model improvements but also some rather nice upgrades elsewhere - notably in XML. And the final reason is the syntactical tuning of the "foreach" statement for use with XML- it really simplifies XML coding.

And in fact one could quickly add a whole raft of additional reasons for using PHP 5 from Web Services enhancements to the availability of SQLite - a great one user database. But do not try to stretch SQLite into multi-user applications particularly with any updates, SQLite will prove that it indeed is lightweight. But as in all of the book, the authors are not doctrinaire. Rather they point out the trade-offs of using different approaches and leave the decision to the developer.

As well the authors are constantly advancing ways to automate steps in the Web Development process. They show how to use session variable to validate data. But then offer an alternative using a generic set of JavaScript functions for form field validations. Likewise in the discussions on security and authentications, the authors point out how neither the database nor the application alone can be responsible for data integrity. And then proceed to show two different authentication models, using session variables but different steps in database validation and support. there is a similar approach to error recovery and reporting.

Finally, the authors wrap this all up with a real winery web application which brings many of the previously discussed issues and code to the fore. In sum, I found this book covering key problems with PHP and MySQL with candor. In addition, the willingness to look at alternative approaches was most welcome. This is particularly true in PHP which has sprouted so many frameworks and libraries in the past year and a half, it was welcome to get discussions on the pro-contra arguments as to how to proceed. Bottom line, when doing MySQL and PHP work, this book is always within handy reach.

Top of Page  Tutorials Home  SQL References