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

PDO::setAttribute

PDO::setAttribute

PHP PDO Reference ManualPHP PDO Reference Manual

PDO::setAttribute - Set an attribute (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)


Description

Syntax


bool PDO::setAttribute ( int $attribute , mixed $value )

Sets a database handle attribute. Some available general attributes are listed below; some drivers may use additional specific attributes.

-

PDO::CASE_LOWER: Forces column names to lowercase.

-

PDO::CASE_NATURAL: Preserves the column names returned by the database driver.

-

PDO::CASE_UPPER: Forces column names to uppercase.

-

PDO::ERRMODE_SILENT: Sets only the error code.

-

PDO::ERRMODE_WARNING: Raises E_WARNING Error

-

PDO::ERRMODE_EXCEPTION: Throws exceptions exception.

-

PDO::NULL_NATURAL: Does not convert.

-

PDO::NULL_EMPTY_STRING: Converts an empty string to NULL.

-

PDO::NULL_TO_STRING: Converts NULL to an empty string.


Return Value

Returns TRUE on success, or FALSE on failure.