Microsoft Drivers for PHP for SQL Server version 2.0 and 3.0 |
PDOStatement::closeCursor |
Example See Also Send Feedback |
Closes the cursor, enabling the statement to be executed again.
Syntax
bool PDOStatement::closeCursor(); |
Return Value
true on success, otherwise false.
Remarks
closeCursor has an effect when the MultipleActiveResultSets connection option is set to false. For more information about the MultipleActiveResultSets connection option, see How to: Disable Multiple Active Resultsets (MARS).
Instead of calling closeCursor, you can also just set the statement handle to null.
Support for PDO was added in version 2.0 of the Microsoft Drivers for PHP for SQL Server.
Example
Copy Code | |
---|---|
<?php $database = "AdventureWorks"; $server = "(local)"; $conn = new PDO( "sqlsrv:server=$server ; Database = $database", "", "", array('MultipleActiveResultSets' => false ) ); $stmt = $conn->prepare('SELECT * FROM Person.ContactType'); $stmt2 = $conn->prepare('SELECT * FROM HumanResources.Department'); $stmt->execute(); $result = $stmt->fetch(); print_r($result); $stmt->closeCursor(); $stmt2->execute(); $result = $stmt2->fetch(); print_r($result); ?> |