Tiffany B. Brown

Review: Learning PHP Data Objects by Dennis Popel

Packt Publishing graciously provided me with a copy of this book to review.

Learning P H P Data Objects PHP supports more than a dozen database setups, including the SQLite library bundled with PHP 5. That’s a lot of databases, and each one has its own connection syntax and server-specific functions.

So what happens when you want to be able to swap one database for another? You turn to an abstraction library, such as PDO.

In Learning PHP Data Objects, Dennis Popel takes you through the process of building an application using PDO with MySQL and SQLite.

Aimed squarely at PHP developers who are new to PDO, Popel covers how to make connections, handle errors, and use prepared statements with PDO. He also discusses transactions, MVC development, and the appropriateness of using PDO versus other abstraction libraries.

Where Learning PHP Data Objects shines, however is in its code examples. They are easy to follow, and Popel smartly alerts readers to potential gotchas in developing the sample application.

The book assumes an understanding of OOPHP — necessary because PDO is entirely object-oriented. To get the most out of it, you should be familiar with object-oriented principles and syntax. While Appendix A does give readers a quick overview of OOPHP, for a more thorough treatment, you’ll need to look elsewhere.

It’s a solid, though not quite perfect book. For example, Popel only sort-of mentions a potentially huge gotcha: when you may need to specify a unix_socket parameter in the connection string. It’s a problem I think would be common enough and confusing enough to discuss and demonstrate. I also think Popel could have been a bit clearer about when and why to use PDOStatement->closeCursor().

Those are minor quibbles however, easily solved by consulting the documentation or doing a Google search. Overall, this book is nice introduction to the whys and hows of using PDO to develop database driven applications.

Quick facts

  • Learning PHP Data Objects
  • By Dennis Popel
  • Packt Publishing
  • September 2007
  • $39.99
  • ISBN number: 978-1-847192-66-0

5 Responses to “Review: Learning PHP Data Objects by Dennis Popel”

  1. Markus says:

    I have read about PDO. Do you know how well it handles a large amount transactions?

  2. Markus says:

    I have read about PDO. Do you know how well it handles a large amount transactions?

  3. tiffany says:

    That I don’t, but I suspect that would depend nearly as much (if not more) on how your database handles them.

  4. tiffany says:

    That I don’t, but I suspect that would depend nearly as much (if not more) on how your database handles them.

  5. [...] is opinionated and bored and six other things, so he writes book reviews. Tiffany Brown reviewed Learning PHP Data Objects by Dennis Popel recently. The Aging Hipser reviewed Craig [...]