# The PDO class

(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)

## Introduction

Represents a connection between PHP and a database server.

## Class synopsis

PDO {
public __construct ( string `$dsn` [, string `$username` [, string `$passwd` [, array `$options` ]]] )
public beginTransaction ( void ) : bool
public commit ( void ) : bool
public errorCode ( void ) : string
public errorInfo ( void ) : array
public exec ( string `$statement` ) : int
public getAttribute ( int `$attribute` ) : mixed
public static getAvailableDrivers ( void ) : array
public inTransaction ( void ) : bool
public lastInsertId ([ string `$name` = `NULL` ] ) : string
public prepare ( string `$statement` [, array `$driver_options` = array() ] ) : PDOStatement
public query ( string `$statement` ) : PDOStatement
public quote ( string `$string` [, int `$parameter_type` = PDO::PARAM_STR ] ) : string
public rollBack ( void ) : bool
public setAttribute ( int `$attribute` , mixed `$value` ) : bool
}

## Table of Contents

- PDO::beginTransaction — Initiates a transaction
- PDO::commit — Commits a transaction
- PDO::__construct — Creates a PDO instance representing a connection to a database
- PDO::errorCode — Fetch the SQLSTATE associated with the last operation on the database handle
- PDO::errorInfo — Fetch extended error information associated with the last operation on the database handle
- PDO::exec — Execute an SQL statement and return the number of affected rows
- PDO::getAttribute — Retrieve a database connection attribute
- PDO::getAvailableDrivers — Return an array of available PDO drivers
- PDO::inTransaction — Checks if inside a transaction
- PDO::lastInsertId — Returns the ID of the last inserted row or sequence value
- PDO::prepare — Prepares a statement for execution and returns a statement object
- PDO::query — Executes an SQL statement, returning a result set as a PDOStatement object
- PDO::quote — Quotes a string for use in a query
- PDO::rollBack — Rolls back a transaction
- PDO::setAttribute — Set an attribute