PDOStatement::closeCursor

PDOStatement::closeCursor

 

DownloadDownload PHP Driver

Closes the cursor, enabling the statement to be executed again.

  
bool PDOStatement::closeCursor();  

true on success, otherwise false.

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.

<?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);  
?>  

PDOStatement Class
PDO

Community Additions

ADD
Show:
© 2016 Microsoft