Author: W. Jason Gilmore
Publisher: Apress, 2010
Aimed at: PHP developers
Pros: Good grounding in PHP and MySQL
Cons: Doesn't really tackle both topics together
Reviewed by: Ian Elliot
PHP and MySQL go together so why not a book on the two showing how they work together to create a website?
This is the fourth edition of a book subtitled "From Novice to Professional" and the first thing to say is that it might be for novices but it isn't for complete beginners. Although its start off with a gentle introduction to PHP's history, it ramps up the level quite quickly.
The main question when you reach the end of Chapter 1 is where is MySQL? Chapter 2 continues to ignore MySQL and shows you how to install PHP and Apache. At this early stage we are taken through the detailed configuration of PHP - again not something that is going to help a beginner.
Chapter 3 gets going fairly slowly with a look at the basics of creating a web page from PHP using print, printf or echo. The chapter then does a lightening introduction to data types and PHP instructions. Chapter 4 goes over functions and 5 is on arrays. Chapter 6 introduces objects and chapter 7 goes into advanced features. From here we move into messy areas of error handling, strings and regular expressions and files and the OS.
At this point, just under halfway, the book has been through most of PHP both theory and practice but on the way we haven't actually met any reasonable examples of how to use it to create a website and where is MySQL?
The next section of the book looks at some of the infrastructure that supports PHP and typical ways in which it is used - overall it's a bit of a random collection of topics taken in an arbitrary order. Chapter 11 explains PEAR - the PHP library, Chapter 12 deals with date and time and Chapter 13 explains how to work with forms using PHP to process the data. Chapter 14 is about authenticating users via a variety of methods - is there a really good one? Then file uploads, networking, LDAP and session management.
Chapter 19 goes a bit off the main track with a look at the Smart template engine which is one way of managing the way PHP generates HTML - the alternative object-oriented approach isn't really discussed. Chapter 20 explains web services but equates this with RSS and Ajax methods for some reason. Chapter 21 tackles localization. Then we have a chapter on the Zend framework - just enough for you to know what it is.
Finally at chapter 25 and page 477, about two thirds of the way through the book we have Introducing MySQL. At this point the book more or less starts over with an introduction and history and basics of using the application but with MySQL as its focus. Several chapters later on we have looked at installing MySQL, using a client and securing the database. Eventually - chapter 30 we reach using PHP with MySQL and again we have a very basic look at connecting to MySQL and making a query. Chapter 31 looks at using PDO the PHP MySQL library and then by Chapter 32 on stored routines its more or less all over. A collection of short chapters on triggers, views, practical aspects and transactions and the book draws to a close.
Has the book been about MySQL and PHP? Well yes it covers both and it shows how PHP can access data in MySQL. What it doesn't really show is the two working together on any larger scale. We don't have any website examples or any extended discussion of the problems of building a data-backed website. It is as if once given the raw tools the rest is obvious.
There is a lot of good stuff in this book and if you can already program and have encountered some PHP then there is a lot to read and discover. However this book doesn't really deal with using the two together. It is more like a book on PHP and a book on MySQL with a few short chapters on where they overlap.
Not a book for the complete beginner and not a good choice if you want something with extended examples showing you how to build web sites using the technology. If you just want the grounding in the two technologies and are happy enough to work out how to use them then this book has something to say.