The `PHP Data Objects` (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. Note that you cannot perform any database functions using the PDO extension by itself; you must use a [database-specific PDO driver](https://www.php.net/manual/en/pdo.drivers.php) to access a database server. PDO provides a _data-access_ abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does _not_ provide a _database_ abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility. PDO ships with PHP. You can learn more from %% run start ```ts const {LinkPreview} = customJS return LinkPreview.getLinkPreviewFromUrl("https://www.php.net/manual/en/book.pdo.php") ``` %% <div class="nifty-link-card-container"> <a class="nifty-link-card" href="https://www.php.net/manual/en/book.pdo.php" target="_blank"> <div class="nifty-link-card-text" style="width: 100%;"> <div class="nifty-link-card-title line-clamp-2">PHP: PDO - Manual</div> <div class="nifty-link-card-description"></div> <div class="nifty-link-href"> <img class="nifty-link-icon" src="https://www.php.net/favicon-196x196.png?v=2"> https://www.php.net/manual/en/book.pdo.php </div> </div> </a> </div> %% run end %% - [Introduction](https://www.php.net/manual/en/intro.pdo.php) - [Installing/Configuring](https://www.php.net/manual/en/pdo.setup.php) - [Requirements](https://www.php.net/manual/en/pdo.requirements.php) - [Installation](https://www.php.net/manual/en/pdo.installation.php) - [Runtime Configuration](https://www.php.net/manual/en/pdo.configuration.php) - [Resource Types](https://www.php.net/manual/en/pdo.resources.php) - [Predefined Constants](https://www.php.net/manual/en/pdo.constants.php) - [Connections and Connection management](https://www.php.net/manual/en/pdo.connections.php) - [Transactions and auto-commit](https://www.php.net/manual/en/pdo.transactions.php) - [Prepared statements and stored procedures](https://www.php.net/manual/en/pdo.prepared-statements.php) - [Errors and error handling](https://www.php.net/manual/en/pdo.error-handling.php) - [Large Objects (LOBs)](https://www.php.net/manual/en/pdo.lobs.php) - [PDO](https://www.php.net/manual/en/class.pdo.php) — The PDO class - [PDO::beginTransaction](https://www.php.net/manual/en/pdo.begintransaction.php) — Initiates a transaction - [PDO::commit](https://www.php.net/manual/en/pdo.commit.php) — Commits a transaction - [PDO::__construct](https://www.php.net/manual/en/pdo.construct.php) — Creates a PDO instance representing a connection to a database - [PDO::errorCode](https://www.php.net/manual/en/pdo.errorcode.php) — Fetch the SQLSTATE associated with the last operation on the database handle - [PDO::errorInfo](https://www.php.net/manual/en/pdo.errorinfo.php) — Fetch extended error information associated with the last operation on the database handle - [PDO::exec](https://www.php.net/manual/en/pdo.exec.php) — Execute an SQL statement and return the number of affected rows - [PDO::getAttribute](https://www.php.net/manual/en/pdo.getattribute.php) — Retrieve a database connection attribute - [PDO::getAvailableDrivers](https://www.php.net/manual/en/pdo.getavailabledrivers.php) — Return an array of available PDO drivers - [PDO::inTransaction](https://www.php.net/manual/en/pdo.intransaction.php) — Checks if inside a transaction - [PDO::lastInsertId](https://www.php.net/manual/en/pdo.lastinsertid.php) — Returns the ID of the last inserted row or sequence value - [PDO::prepare](https://www.php.net/manual/en/pdo.prepare.php) — Prepares a statement for execution and returns a statement object - [PDO::query](https://www.php.net/manual/en/pdo.query.php) — Prepares and executes an SQL statement without placeholders - [PDO::quote](https://www.php.net/manual/en/pdo.quote.php) — Quotes a string for use in a query - [PDO::rollBack](https://www.php.net/manual/en/pdo.rollback.php) — Rolls back a transaction - [PDO::setAttribute](https://www.php.net/manual/en/pdo.setattribute.php) — Set an attribute - [PDOStatement](https://www.php.net/manual/en/class.pdostatement.php) — The PDOStatement class - [PDOStatement::bindColumn](https://www.php.net/manual/en/pdostatement.bindcolumn.php) — Bind a column to a PHP variable - [PDOStatement::bindParam](https://www.php.net/manual/en/pdostatement.bindparam.php) — Binds a parameter to the specified variable name - [PDOStatement::bindValue](https://www.php.net/manual/en/pdostatement.bindvalue.php) — Binds a value to a parameter - [PDOStatement::closeCursor](https://www.php.net/manual/en/pdostatement.closecursor.php) — Closes the cursor, enabling the statement to be executed again - [PDOStatement::columnCount](https://www.php.net/manual/en/pdostatement.columncount.php) — Returns the number of columns in the result set - [PDOStatement::debugDumpParams](https://www.php.net/manual/en/pdostatement.debugdumpparams.php) — Dump an SQL prepared command - [PDOStatement::errorCode](https://www.php.net/manual/en/pdostatement.errorcode.php) — Fetch the SQLSTATE associated with the last operation on the statement handle - [PDOStatement::errorInfo](https://www.php.net/manual/en/pdostatement.errorinfo.php) — Fetch extended error information associated with the last operation on the statement handle - [PDOStatement::execute](https://www.php.net/manual/en/pdostatement.execute.php) — Executes a prepared statement - [PDOStatement::fetch](https://www.php.net/manual/en/pdostatement.fetch.php) — Fetches the next row from a result set - [PDOStatement::fetchAll](https://www.php.net/manual/en/pdostatement.fetchall.php) — Fetches the remaining rows from a result set - [PDOStatement::fetchColumn](https://www.php.net/manual/en/pdostatement.fetchcolumn.php) — Returns a single column from the next row of a result set - [PDOStatement::fetchObject](https://www.php.net/manual/en/pdostatement.fetchobject.php) — Fetches the next row and returns it as an object - [PDOStatement::getAttribute](https://www.php.net/manual/en/pdostatement.getattribute.php) — Retrieve a statement attribute - [PDOStatement::getColumnMeta](https://www.php.net/manual/en/pdostatement.getcolumnmeta.php) — Returns metadata for a column in a result set - [PDOStatement::getIterator](https://www.php.net/manual/en/pdostatement.getiterator.php) — Gets result set iterator - [PDOStatement::nextRowset](https://www.php.net/manual/en/pdostatement.nextrowset.php) — Advances to the next rowset in a multi-rowset statement handle - [PDOStatement::rowCount](https://www.php.net/manual/en/pdostatement.rowcount.php) — Returns the number of rows affected by the last SQL statement - [PDOStatement::setAttribute](https://www.php.net/manual/en/pdostatement.setattribute.php) — Set a statement attribute - [PDOStatement::setFetchMode](https://www.php.net/manual/en/pdostatement.setfetchmode.php) — Set the default fetch mode for this statement - [PDOException](https://www.php.net/manual/en/class.pdoexception.php) — The PDOException class - [PDO Drivers](https://www.php.net/manual/en/pdo.drivers.php) - [CUBRID (PDO)](https://www.php.net/manual/en/ref.pdo-cubrid.php) — CUBRID Functions (PDO_CUBRID) - [MS SQL Server (PDO)](https://www.php.net/manual/en/ref.pdo-dblib.php) — Microsoft SQL Server and Sybase Functions (PDO_DBLIB) - [Firebird (PDO)](https://www.php.net/manual/en/ref.pdo-firebird.php) — Firebird Functions (PDO_FIREBIRD) - [IBM (PDO)](https://www.php.net/manual/en/ref.pdo-ibm.php) — IBM Functions (PDO_IBM) - [Informix (PDO)](https://www.php.net/manual/en/ref.pdo-informix.php) — Informix Functions (PDO_INFORMIX) - [MySQL (PDO)](https://www.php.net/manual/en/ref.pdo-mysql.php) — MySQL Functions (PDO_MYSQL) - [MS SQL Server (PDO)](https://www.php.net/manual/en/ref.pdo-sqlsrv.php) — Microsoft SQL Server Functions (PDO_SQLSRV) - [Oracle (PDO)](https://www.php.net/manual/en/ref.pdo-oci.php) — Oracle Functions (PDO_OCI) - [ODBC and DB2 (PDO)](https://www.php.net/manual/en/ref.pdo-odbc.php) — ODBC and DB2 Functions (PDO_ODBC) - [PostgreSQL (PDO)](https://www.php.net/manual/en/ref.pdo-pgsql.php) — PostgreSQL Functions (PDO_PGSQL) - [SQLite (PDO)](https://www.php.net/manual/en/ref.pdo-sqlite.php) — SQLite Functions (PDO_SQLITE)