Skip to content

Latest commit

 

History

History
66 lines (47 loc) · 1.8 KB

File metadata and controls

66 lines (47 loc) · 1.8 KB
title PDOStatement::closeCursor | 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 8997ab61-e948-4d54-8d32-fc080d55525c
author MightyPen
ms.author genemi
manager craigg

PDOStatement::closeCursor

[!INCLUDEDriver_PHP_Download]

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 [!INCLUDEssDriverPHP].

Example

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

See Also

PDOStatement Class

PDO