This book will introduce you to one of the most important extensions to PHP that are available, starting with PHP version 5.0—the PHP Data Objects, commonly known as PDO.PHP grew in to a very popular web programming language due to its simplicity and ease of use. One of the key factors of this growing success is the built-in possibility to access many popular relational database management systems (RDBMS), such as MySQL, PostgreSQL, and SQLite, to name just a few. Today, most of the existing and newly created web applications interconnect with these databases to produce dynamic, data-driven websites.While most PHP-enabled web servers are still running PHP versions prior to 5.0, the enhancements and performance improvements introduced with this new version will lead to wide acceptance of PHP 5 at all levels during coming years. This imposes the need to start familiarizing ourselves with all the advanced features available in this version today.
What This Book CoversChapter 1 gives an overview of PDO along with a few features likes single interface for creating a connection, connection strings, uniform statement methods, and use of exceptions and a singe system of error codes.Chapter 2 helps to get you started with PDO, by creating a sample database and then by creating a connection object. It also introduces PDOStatement classes.Chapter 3 deals with various error-handling processes and their uses.Chapter 4 introduces prepared statements. It deals with using prepared statements without binding values, binding a variable, and binding a parameter to a prepared statement. We also take a look at how to work with BLOBs using streams so that we do not risk query failures.Chapter 5 helps us determine the number of rows in the returned result set. Also, we come across a new concept—scrollable cursors, which allow us to fetch subsets of rows from a result set.Chapter 6 talks about advanced uses of PDO and includes setting connection parameters, transactions, and methods of PDO and the PDOStatement class.Chapter 7 gives an example, where creation of the method part of an MVC application is discussed.Appendix A explains the object-oriented features like inheritance, encapsulation, polymorphism, and exception handling.
A good book on Data Objects