The folks at Packt Publishing sent me a copy of Dennis Popel’sLearning 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?

Yes.

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.

Conclusion

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.

7 Comments

  1. Lukas says:
    October 22nd, 2007 at 8:23 am

    Its very unlikely that any money will be accepted by the php group since it has declined all money in the past (including the money that projects get for doing SoC mentoring). The gist is that the PHP group considers it too much work to manage the necessary legal infrastructure, given the open question of how that money should be allocated to people.

    Personally I see in person meetings as the most interesting thing here, but so far conferences have solved most of the in person meeting needs. Also companies frequently step up and chip in goodies when people in the community want to run a contest.

  2. Wez Furlong says:
    October 22nd, 2007 at 2:48 pm

    I haven’t bought the book, but someone had a copy at ZendCon, and I flicked through it.

    Firstly, I was surprised that someone actually wrote a book on PDO, and secondly that I didn’t know about it until I saw it on the desk. :-)

    It looked like a good overview of using PDO, and I don’t recall shaking my head at any of the bits that I read (unlike the streams section of one of the zend certification books!). I remember thinking that one or two of the statements made in the book were not 100% accurate, or what I would have told people, but they were close enough.

    I also agree that it’s a read once-or-twice book and not a reference.

  3. developercast.com » Stuart Herbert’s Blog: Learning PHP Data Objects, by Dennis Popel says:
    October 23rd, 2007 at 2:16 pm

    [...] Herbert has posted a new book review of a new offering from Packt Publishing – “Learning PHP Data Objects” (by Dennis [...]

  4. Learning PHP Data Objects Book Review | MT-Soft Website Development says:
    October 23rd, 2007 at 5:39 pm

    [...] Objects Book Review Posted in October 23rd, 2007 by admin in News, PHP News Stuart Herbert has posted a new book review of a new offering from Packt Publishing – “Learning PHP Data Objects” (by Dennis [...]

  5. William Betts says:
    October 28th, 2007 at 5:29 pm

    I’m going to check this book out. This book sounds like it would be a good one to lay around the office.

  6. gavD says:
    November 5th, 2007 at 2:51 pm

    I read this over the weekend, and it’s ok. It could have used some proofreading – there are many grammatical errors in it, and some of the example source is malformatted.

    It’s a pretty good introduction to PDO; it doesn’t go into massive technical detail about the underlying architecture, but as a guide to get you up and running, it’ll do the job,

  7. Dennis says:
    November 22nd, 2007 at 5:36 pm

    You can find links to reviews by other readers in this post: http://www.onphp5.com/article/58

    Thanks for a positive review, Stuart!