php-sqlsrv/test/bvt/pdo_sqlsrv/msdn_pdoStatement_bindColumn.phpt

24 lines
607 B
PHP

--TEST--
a variable bound to a column in a result set
--SKIPIF--
<?php require('skipif.inc'); ?>
--FILE--
<?php
require('connect.inc');
$conn = new PDO( "sqlsrv:server=$server ; Database = $databaseName", "$uid", "$pwd");
$query = "SELECT Title, FirstName, EmailPromotion FROM Person.Person where LastName = 'Estes'";
$stmt = $conn->prepare($query);
$stmt->execute();
$stmt->bindColumn('EmailPromotion', $emailpromo);
while ( $row = $stmt->fetch( PDO::FETCH_BOUND ) ){
echo "EmailPromotion: $emailpromo\n";
}
//free the statement and connection
$stmt=null;
$conn=null;
?>
--EXPECT--
EmailPromotion: 2