Table of Contents
Preface
Chapter 1: Introduction
Chapter 2: Using PHP Data Objects: First Steps
Chapter 3: Error Handling
Chapter 4: Prepared Statements
Chapter 5: Handling Rowsets
Chapter 6: Advanced PDO Usage
Chapter 7: An Advanced Example
Appendix A: Introduction to OOP in PHP5
Index
- Chapter 1: Introduction
- Using PDO
- Connecting to the Database
- Connection Strings
- Issuing SQL Queries, Quoting Parameters, and Handling Result Sets
- Error Handling
- Prepared Statements
- Appropriate Understanding of PDO
- Summary
- Using PDO
- Chapter 2: Using PHP Data Objects: First Steps
- Connection Strings
- Creating the Sample Database
- The Data Model
- Creating the MySQL Database
- Creating the Sample Database
- Designing Our Code
- PDO Statements and Result Sets
- Retrieving Result Set Metadata
- Summary
- Connection Strings
- Chapter 3: Error Handling
- Sources of Errors
- Server Software Failure or Overload
- Improper Configuration of the Application
- Improper Validation of User Input
- Inserting a Record with a Duplicate Primary Key or Unique Index Value
- Syntax Errors in SQL Statements
- Types of Error Handling in PDO
- Defining an Error Handling Function
- Creating the Edit Book Page
- Creating the Edit Author Page
- Securing against Uncaught Exceptions
- Summary
- Sources of Errors
- Chapter 4: Prepared Statements
- Prepared Statements
- Positional and Named Placeholders
- Prepared Statements and Bound Values
- Working with BLOBs
- Summary
- Prepared Statements
- Chapter 5: Handling Rowsets
- Retrieving the Number of Rows in a Result Set
- Limiting the Number of Rows Returned
- Using Database-Specific SQL
- Processing the Top N Rows Only
- Starting at an Arbitrary Offset
- Summary
- Chapter 6: Advanced PDO Usage
- Setting and Getting Connection Attributes
- MySQL Buffered Queries
- Connecting Using the Connection Configuration File and php.ini Setting
- Getting the List of Available Drivers
- Transactions
- Summary
- Chapter 7: An Advanced Example
- Designing the Model
- Modifying the Frontend to Use the Model
- Advantages of Separating the Model
- Further Thoughts
- Finishing Up
- Appendix A: Introduction to OOP in PHP5
- What is Object-Oriented Programming?
- The Syntax for Declaring Objects
- Constructors
- Destructors
- The Advantages of OOP
- Inheritance
- Encapsulation
- Polymorphism
- Static Properties, Methods, and Class Constants
- Exceptions
- Summary
- What is Object-Oriented Programming?



