|PHP and MySQL for Dynamic Web Sites|
Author: Larry Ulman
While the previous edition of this book was aimed at PHP 6, this 4th Edition seems to jump back by covering PHP 5.3.
Author: Larry Ulman
This must be one of the few books that jumps back a version in the language it covers, as the previous edition was aimed at PHP 6, whereas this version has gone back to PHP 5.3, the current stable version. The problem the author had was that he wrote the previous edition on the basis that PHP 6 was just around the corner, and it has never appeared.
The book kicks off with three chapters on PHP, and as so often with programming books, it’s tricky knowing what knowledge should be assumed in the reader. Ulman takes the view that you need to start from the very basics of what a variable is, what strings are, and other fundamentals. There’s a chapter on programming with PHP that introduces conditionals and operators, arrays and loops, and a final chapter on PHP that actually gets on to the elements of creating dynamic web sites that are the tricky bits such as creating sticky forms.
The next section of the book covers MySQL, and this is written in rather more detail than the PHP part. As with the PHP part of the book, the material starts off very basic at the level of ‘there are three basic column types in MySQL, text, numbers and dates’. There’s a chapter that dashes through writing basic SQL, and another that gives a fairly poor introduction to database normalization. A final chapter on MySQL looks at different types of table joins, optimizing queries and performing transactions.
With both the PHP and MySQL sections, I think the best summary is that if you didn’t understand them before reading this book, I’m not sure you’d understand them afterwards.
The final section of the book explains looks at how PHP and MySQL work when used together, starting with how you actually get MySQL results into PHP, and going through ideas such as cookies and sessions, security methods, and jQuery, and ending with a look at three examples - a message board, user registration, and e-commerce in the form of a shopping cart. This is undoubtedly the most useful part of the book, and the author seems to be clearer in his explanations when covering practical ideas.
The one new chapter in this edition is a short object-oriented primer. This is just 14 pages long, and mainly consists of examples from elsewhere in the book written in an object-oriented style. The author says he covers object-oriented programming in another book, but it does seem a missed opportunity.
One unusual thing about the book is the layout; it’s laid out in two columns, and while longer code examples are laid out using the entire page width, there’s a lot of code embedded in the text that suffers from having to fit into the two-column layout. Picking an example more or less at random, a single line of code changing a radio button is split across seventeen lines of text. Another point where the layout seemed less than ideal was that helpful tips run throughout the book, and some do contain useful information. However, they seemed to be lumped together rather randomly, so there would be three or four pages with no tips, then an entire column of six or eight tips that seemed to be presented together just to save space.
Overall, I think this would be a useful book to have on your shelf as part of a library. I certainly wouldn’t want to learn PHP or MySQL from it, but the chapters on using them together when designing websites are practical and useful. There are lots of examples that you can use to work out where you’re going wrong, and the author is well known for being helpful with reader queries on the forums of his website.