PDO

suggest change

Versions

[{“Name”:“5.0”,“GroupName”:“PHP 5.x”},{“Name”:“5.1”,“GroupName”:“PHP 5.x”},{“Name”:“5.2”,“GroupName”:“PHP 5.x”},{“Name”:“5.3”,“GroupName”:“PHP 5.x”},{“Name”:“5.4”,“GroupName”:“PHP 5.x”},{“Name”:“5.5”,“GroupName”:“PHP 5.x”},{“Name”:“5.6”,“GroupName”:“PHP 5.x”},{“Name”:“7.0”,“GroupName”:“PHP 7.x”},{“Name”:“7.1”,“GroupName”:“PHP 7.x”}]

Introduction

The PDO (PHP Data Objects) extension allows developers to connect to numerous different types of databases and execute queries against them in a uniform, object oriented manner.

Syntax

Remarks

Warning Do not miss to check for exceptions while using lastInsertId(). It can throw the following error:

SQLSTATE IM001 : Driver does not support this function

Here is how you should properly check for exceptions using this method :

// Retrieving the last inserted id
$id = null;

try {
    $id = $pdo->lastInsertId(); // return value is an integer    
}
catch( PDOException $e ) {
    echo $e->getMessage();
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


PDO:
* PDO

Table Of Contents
2 Arrays
4 Types
10 Cookies
14 JSON
15 SOAP
17 cURL
19 XML
21 Traits
35 UTF-8
36 URLs
38 PHPDoc
41 Loops
44 Closur
72 YAML
77 Cache
78 Streams
81 PDO
82 SQLite3
83 Sockets
87 MongoDB
93 IMAP
94 Redis
95 Imagick
102 APCu
108 PSR