Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sqlsrv_free_stmt(3) [php man page]

SQLSRV_FREE_STMT(3)													       SQLSRV_FREE_STMT(3)

sqlsrv_free_stmt - Frees all resources for the specified statement

SYNOPSIS
bool sqlsrv_free_stmt (resource $stmt) DESCRIPTION
Frees all resources for the specified statement. The statement cannot be used after sqlsrv_free_stmt(3) has been called on it. If sql- srv_free_stmt(3) is called on an in-progress statement that alters server state, statement execution is terminated and the statement is rolled back. PARAMETERS
o $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. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 sqlsrv_free_stmt(3) example <?php $serverName = "serverNamesqlexpress"; $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); ?> NOTES
The main difference between sqlsrv_free_stmt(3) and sqlsrv_cancel(3) is that a statement resource cancelled with sqlsrv_cancel(3) can be re-executed if it was created with sqlsrv_prepare(3). A statement resource cancelled with sqlsrv_free_statement(3) cannot be re-executed. SEE ALSO
sqlsrv_cancel(3). PHP Documentation Group SQLSRV_FREE_STMT(3)

Check Out this Related Man Page

SQLSRV_GET_FIELD(3)													       SQLSRV_GET_FIELD(3)

sqlsrv_get_field - Gets field data from the currently selected row

SYNOPSIS
mixed sqlsrv_get_field (resource $stmt, int $fieldIndex, [int $getAsType]) DESCRIPTION
Gets field data from the currently selected row. Fields must be accessed in order. Field indices start at 0. PARAMETERS
o $stmt - A statement resource returned by sqlsrv_query(3) or sqlsrv_execute(3). o $fieldIndex - The index of the field to be retrieved. Field indices start at 0. Fields must be accessed in order. i.e. If you access field index 1, then field index 0 will not be available. o $getAsType - The PHP data type for the returned field data. If this parameter is not set, the field data will be returned as its default PHP data type. For information about default PHP data types, see Default PHP Data Types in the Microsoft SQLSRV documentation. RETURN VALUES
Returns data from the specified field on success. Returns FALSE otherwise. EXAMPLES
Example #1 sqlsrv_get_field(3) example The following example demonstrates how to retrieve a row with sqlsrv_fetch(3) and get the row fields with sqlsrv_get_field(3). <?php $serverName = "serverNamesqlexpress"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { die( print_r( sqlsrv_errors(), true)); } $sql = "SELECT Name, Comment FROM Table_1 WHERE ReviewID=1"; $stmt = sqlsrv_query( $conn, $sql); if( $stmt === false ) { die( print_r( sqlsrv_errors(), true)); } // Make the first (and in this case, only) row of the result set available for reading. if( sqlsrv_fetch( $stmt ) === false) { die( print_r( sqlsrv_errors(), true)); } // Get the row fields. Field indeces start at 0 and must be retrieved in order. // Retrieving row fields by name is not supported by sqlsrv_get_field. $name = sqlsrv_get_field( $stmt, 0); echo "$name: "; $comment = sqlsrv_get_field( $stmt, 1); echo $comment; ?> SEE ALSO
sqlsrv_fetch(3), sqlsrv_fetch_array(3), sqlsrv_fetch_object(3). PHP Documentation Group SQLSRV_GET_FIELD(3)
Man Page