HomePHP Handling Result Sets and More with PDO Objects in PHP 5
Handling Result Sets and More with PDO Objects in PHP 5
Building PHP applications that interact with different database systems can be a daunting task, especially from a developer's point of view. To tackle this issue with minor hassles, PHP 5.1 comes bundled with a powerful extension called PDO (short for PHP Data Objects), a library that definitely takes database abstraction to the ultimate level.
Welcome to the second installment of the series that began with "Using PDO objects in PHP 5." In three approachable tutorials, this series walks you through the implementation of the most important features offered by the PDO extension, and complements its theoretical aspects with concrete examples. In this way you will be able to start quickly using it in your own PHP applications.
Stepping back for a moment to the first article of the series, it's quite probable that you'll recall how this educational journey began. In simple terms, I started explaining some basic tasks that can be performed with the PDO extension, such as opening and closing a connection to diverse database systems (MySQL, Oracle, MS SQL, etc.), in addition to running queries against a selected database and handling PDO exceptions.
Also, it's important to notice here that this PHP library lets you perform all the tasks mentioned above by using an object-oriented notation. This means that if you use this paradigm on a frequent basis when developing your PHP programs, you should take it for granted that you'll feel really comfortable implementing most of its features.
All in all, at this point you hopefully learned how to use some basic methods included with this PHP extension, but logically you may want to learn a few additional ones, so you can have a more polished picture of the overall functionality of the library in question.
Thus, keeping this in mind, over the course of this second tutorial of the series, I'm going to show you how to use the PDO extension to handle different database result sets in all sort of clever ways, in addition to performing some common tasks, like counting rows and columns as well.
Are you ready to take the next step in this instructive journey? Okay, let's begin now!