--- title: "PDOStatement::bindColumn | Microsoft Docs" ms.custom: "" ms.date: "01/19/2017" ms.prod: sql ms.prod_service: connectivity ms.reviewer: "" ms.technology: connectivity ms.topic: conceptual ms.assetid: bbdcea53-d23d-4769-89a0-95c7cf4d5390 author: David-Engel ms.author: v-daenge --- # PDOStatement::bindColumn [!INCLUDE[Driver_PHP_Download](../../includes/driver_php_download.md)] Binds a variable to a column in a result set. ## Syntax ``` bool PDOStatement::bindColumn($column, &$param[, $type[, $maxLen[, $driverdata ]]] ); ``` #### Parameters $*column*: The (mixed) number of the column (1-based index) or name of the column in the result set. &$*param*: The (mixed) name of the PHP variable to which the column will be bound. $*type*: The optional data type of the parameter, represented by a PDO::PARAM_* constant. $*maxLen*: Optional integer, not used by the Microsoft Drivers for PHP for SQL Server. $*driverdata*: Optional mixed parameter(s) for the driver. For example, you could specify PDO::SQLSRV_ENCODING_UTF8 to bind the column to a variable as a string encoded in UTF-8. ## Return Value TRUE if success, otherwise FALSE. ## Remarks Support for PDO was added in version 2.0 of the [!INCLUDE[ssDriverPHP](../../includes/ssdriverphp_md.md)]. ## Example This example shows how a variable can be bound to a column in a result set. ``` prepare($query); $stmt->execute(); $stmt->bindColumn('EmailAddress', $email); while ( $row = $stmt->fetch( PDO::FETCH_BOUND ) ){ echo "$email\n"; } ?> ``` ## See Also [PDOStatement Class](../../connect/php/pdostatement-class.md) [PDO](https://php.net/manual/book.pdo.php)