Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PDO::getAttribute

PDO::getAttribute

PHP PDO Reference ManualPHP PDO Reference Manual

PDO::getAttribute - Retrieve a database connection attribute (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)


Description

Syntax



mixed PDO::getAttribute ( int $attribute )

This function (method) returns the attribute value of a database connection. To retrieve PDOStatement attributes, see PDOStatement::getAttribute().

Note that some databases/drivers may not support all database connection attributes.

Parameter Description:

attribute:
One of the PDO::ATTR_* constants. The following are constants applied to the database connection:


Return Value

On successful call, returns the requested PDO attribute value. On failure, returns null.

Example

Retrieve a database connection attribute



getAttribute(constant("PDO::ATTR_$val")) . "\n";

}

?>

PHP PDO Reference ManualPHP PDO Reference Manual