sqlsrv_free_stmt

(No version information available, might only be in Git)
Frees all resources for the specified statement
bool sqlsrv_free_stmt ( resource $stmt )

Frees all resources for the specified statement. The statement cannot be used after sqlsrv_free_stmt() has been called on it. If sqlsrv_free_stmt() is called on an in-progress statement that alters server state, statement execution is terminated and the statement is rolled back.

Parameters:
stmt

The statment for which resources are freed. Note that NULL is a valid parameter value. This allows the function to be called multiple times in a script.

Returns:

Returns TRUE on success or FALSE on failure.

Examples:
sqlsrv_free_stmt() example
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
     die( print_r( sqlsrv_errors(), true));
}

$stmt = sqlsrv_query( $conn, "SELECT * FROM Table_1");
if( $stmt === false ) {
     die( print_r( sqlsrv_errors(), true));
}

/*-------------------------------
     Process query results here.
-------------------------------*/

/* Free the statement resources. */
sqlsrv_free_stmt( $stmt);

?>

See also:

sqlsrv_cancel() -

doc_php
2016-02-24 16:18:40
Comments
Leave a Comment

Please login to continue.