The folks at Packt Publishing sent me a copy of Dennis Popel’s “Learning PHP Data Objects” to review. I’d never heard of Packt before, and was intrigued. They’re a relatively new publisher, with a growing range of books on PHP-related topics, and they remind me of what O’Reilly was like when they first started out. According to their About Us page, they also pay a royalty direct to open source projects – so sales from Dennis’ book should result in money coming the PHP Group’s way.
What Does The Book Claim To Do?
The jacket of the book says that, by reading the book, you’ll learn:
- An overview of the technology
- Getting started with PDO
- Creating sample databases
- Different methods of creating connection strings
- Error handling, prepared statements, and handling rowsets
- Getting column metadata
- Setting connection parameters with examples
- Handling rowsets and different ways to retrieve multiple rows
The book also includes a helpful appendix on PHP object-oriented programming for readers who aren’t familiar with using PHP this way.
My copy of the book doesn’t include a CD with the code listings on, and I wasn’t able to find the code listings online to download. That’s something I’d like to see Packt change in the next edition; I thought we’d stopped having to type in code examples with the demise of the good ol’ ZX Spectrum 🙂 I haven’t tested the example code in the books as a result, and given Lukas’s concerns about errors in the code found in another of Packt’s books, don’t be surprised if there are issues here. But don’t be put off by it either.
Does It Do What It Says On The Tin?
If you’ve never used PHP’s PDO before, and you’re looking for a book to get you up and running, then you should take a look at Learning PHP Data Objects. The book covers all the basics, plus error handling (something I personally heartily approve of 🙂 ), and also topics like streaming BLOB objects from the database out to the browser.
This isn’t a book that aims to teach you SQL, nor the differences between the different SQL dialects supported by your favourite database platforms; it’s totally focused on the PDO side of things. This is a good thing; it ensures that the examples and text aren’t constantly full of tony tangents distracting you from the main reason for buying this book: to learn PDO.
Is This A Book You Will Go Back To In The Future?
I’m not sure. From start to finish, the book is written as a tutorial rather than a reference, staying true to the book’s title and mission. I feel that the book’s index is incredibly weak, which is a shame, but not unexpected in a tutorial book. It’s the sort of book that you’d like to have on the company’s bookshelf to help new starters get up to speed with PDO, but it’s likely to stay on the shelf afterwards.
If you’re new to PHP, or haven’t yet made the move from PHP 4 to PHP 5, then this book can help you get started with one of the important new features of PHP 5. It’s a book that does exactly what it says on the tin, which is a refreshing change 🙂
Whilst there’s plenty of online tutorials about PDO out there, for the folks who prefer to read a real book, as far as I can tell after a quick bit of Googling this is the only book out there to date that’s dedicated solely to covering PDO (if you know of any such books, please leave a link to them in the comments below).
If you’ve bought this book and have an opinion on it, please leave a comment.