sqlsrv_free_stmt
sqlsrv_free_stmt
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 has been called on it. If
is called on an in-progress statement
that alters server state, statement execution is terminated and the statement
is rolled back.
sqlsrv_free_stmt``sqlsrv_free_stmt
stmtThe statement 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.
return.success
Voorbeeld: 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);
?>
The main difference between and
is that a statement resource cancelled with
can be re-executed if it was created with
. A statement resource cancelled with
cannot be re-executed.
sqlsrv_free_stmt``sqlsrv_cancel``sqlsrv_cancel``sqlsrv_prepare``sqlsrv_free_statement
sqlsrv_cancel