A handy sized reference covering both PHP and MySQL - or so the cover suggests.

Online documentation is all very well, but tabbing round your sixteen open browser windows to see the help topic quickly gets tedious. On the other hand, carrying around a book the dimensions and weight of several combined house bricks is no fun either. This is the market the ‘Phrasebook’ series of books aims to address. PHP and MySQL Phrasebook is out in an updated edition for PHP 5.4, and hits the mark so far as half the title goes.

It’s has good general coverage of PHP, but this isn’t a book about using PHP with MySQL. There’s one short chapter of 14 pages on PHP and MySQL (and that’s not until you get to page 229), and another on using PHP with other databases. Other than that, this is a plain vanilla guide to PHP; not that there’s anything wrong with that, but just don’t buy this to learn in depth how to use PHP and MySQL together, nor to learn MySQL.

So long as you’re wanting to know about PHP rather than MySQL, the book is well written and hits the mark. Introductory material is missed out, and the first chapter begins with a look at working with strings. This is followed by chapters on arrays and date and time, all the essentials you’d need to get straight to the heart of coding in PHP.

By Chapter 4, Wenz has moved on to working with objects in PHP, and covers classes, inheritance, abstract classes, namespaces and traits. Like the rest of the book, you wouldn’t want to learn about object oriented programming using the material, but it’s ideal for finding out how PHP handles OOP.

Chapter 5 covers web forms, and starts with the basics of form data, cookies and passwords. Multiline fields, radio buttons, checkboxes and selection lists are looked at next, along with mandatory fields. Having shown you how to get the data in, Wenz moves on to what you might do with it. He briefly discusses escaping output, but you’d need to understand the concept from elsewhere to understand what he means. The sections on validating input and sending the data to a file, email or other endpoint are dealt with more clearly. Cookies and sessions get a chapter to themselves and are dealt with clearly.

At this point the book moves on to ways of storing data, starting with a chapter on working with file server files including PHP Streams and Bzip2 archives. MySQL gets a chapter showing how you connect to MySQL, send SQL commands, retrieve query results and use transactions. The material is clear and if you already know MySQL will be enough to show you how it works with PHP. The next chapter looks at working with other databases - SQLite, PostgreSQL, Oracle, Microsoft SQL Server, Firebird and PDO. There’s a chapter on using XML that introduces parsing XML from PHP using SAX and XMLReader, using DOM and XMLWriter, and using XPath with SimpleXML. In each case the description includes sample PHP showing the basic commands, along with a couple of paragraphs giving a brief overview of the process of using the tool under consideration. The final chapter covers communicating with other systems - HTTP servers, FTP Servers, generating and consuming Web Services using NuSOAP, and using the PHP 5 SOAP extension.

My verdict on this book is twofold. Taken purely as a PHP phrasebook, it serves its purpose pretty well. The coverage of some material seemed a bit rushed, but a competent programmer would probably have enough info for them to work out what is going on. Taken as a PHP and MySQL Phrasebook, the implication is that you’re being shown how to use PHP and MySQL together throughout the book, and that’s just not what you get.