pdo Functionspdo
&reftitle.intro;
&warn.experimental;
The PDO extension defines a lightweight, consistent interface
for accessing databases in PHP. Each database driver that
implements the PDO interface can expose database-specific
features as regular extension functions.
&reftitle.install;
PDO is currently available as a PECL extension from
&url.pecl.package;pdo.
Ensure you have installed the CGI version of PHP and that the
pear and phpize scripts are
available in your current path.
Run the following command to download, build, and install the
latest stable version of PDO:
Windows users can download the extension DLL pdo.dll
from &url.pecl.get.win;
The pear command automatically installs the
PDO module into your PHP extensions directory. To enable the
PDO extension on UNIX or Linux operating systems, you must add
the following line to &php.ini;:
To enable the PDO extension on Windows operating systems, you must
add the following line to &php.ini;:
&reftitle.classes;
PDO
Represents a connection between PHP and a database server.
&reftitle.constructor;
PDO - constructs a new PDO
object
&reftitle.methods;
beginTransaction
- begins a transactioncommit - commits a
transactionexec - issues an SQL
statementerrorCode -
retrieves an error code, if any, from the databaseerrorInfo -
retrieves an array of error information, if any, from the
databaselastInsertId -
retrieves the value of the last row that was inserted into a
tableprepare - prepares
an SQL statement for executionrollBack - roll
back a transactionsetAttribute -
sets a database connection attributePDOStatementRepresents a prepared statement and, after the statement is
executed, an associated result set.
&reftitle.methods;
bindColumn - binds a
PHP variable to an output column in a result setbindParam - binds a
PHP variable to a parameter in the prepared statementerrorCode -
retrieves an error code, if any, from the statementerrorInfo -
retrieves an array of error information, if any, from the statementexecute - executes a
prepared statementfetch - fetches a
row from a result setfetchAll - fetches an
array containing all of the rows from a result setfetchSingle - returns
the data from the first column in a result setrowCount - returns the
number of rows that were affected by the execution of an SQL statement
&reference.pdo.constants;
&reference.pdo.functions;