Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sqlsrv_num_rows(3) [php man page]

SQLSRV_NUM_ROWS(3)														SQLSRV_NUM_ROWS(3)

sqlsrv_num_rows - Retrieves the number of rows in a result set

SYNOPSIS
mixed sqlsrv_num_rows (resource $stmt) DESCRIPTION
Retrieves the number of rows in a result set. This function requires that the statment resource be created with a static or keyset cursor. For more information, see sqlsrv_query(3), sqlsrv_prepare(3), or Specifying a Cursor Type and Selecting Rows in the Microsoft SQLSRV docu- mentation. PARAMETERS
o $stmt - The statement for which the row count is returned. The statment resource must be created with a static or keyset cursor. For more information, see sqlsrv_query(3), sqlsrv_prepare(3), or Specifying a Cursor Type and Selecting Rows in the Microsoft SQLSRV documentation. RETURN VALUES
Returns the number of rows retrieved on success and FALSE if an error occurred. If a forward cursor (the default) or dynamic cursor is used, FALSE is returned. EXAMPLES
Example #1 sqlsrv_num_rows(3) example <?php $server = "serverNamesqlexpress"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" ); $conn = sqlsrv_connect( $server, $connectionInfo ); $sql = "SELECT * FROM Table_1"; $params = array(); $options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET ); $stmt = sqlsrv_query( $conn, $sql , $params, $options ); $row_count = sqlsrv_num_rows( $stmt ); if ($row_count === false) echo "Error in retrieveing row count."; else echo $row_count; ?> SEE ALSO
sqlsrv_has_rows(3), sqlsrv_rows_affected(3). PHP Documentation Group SQLSRV_NUM_ROWS(3)

Check Out this Related Man Page

SQLSRV_SEND_STREAM_DATA(3)												SQLSRV_SEND_STREAM_DATA(3)

sqlsrv_send_stream_data - Sends data from parameter streams to the server

SYNOPSIS
bool sqlsrv_send_stream_data (resource $stmt) DESCRIPTION
Send data from parameter streams to the server. Up to 8 KB of data is sent with each call. PARAMETERS
o $stmt - A statement resource returned by sqlsrv_query(3) or sqlsrv_execute(3). RETURN VALUES
Returns TRUE if there is more data to send and FALSE if there is not. EXAMPLES
Example #1 sqlsrv_send_stream_data(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)); } $sql = "UPDATE Table_1 SET data = ( ?) WHERE id = 100"; // Open parameter data as a stream and put it in the $params array. $data = fopen( "data://text/plain,[ Lengthy content here. ]", "r"); $params = array( &$data); // Prepare the statement. Use the $options array to turn off the // default behavior, which is to send all stream data at the time of query // execution. $options = array("SendStreamParamsAtExec"=>0); $stmt = sqlsrv_prepare( $conn, $sql, $params, $options); sqlsrv_execute( $stmt); // Send up to 8K of parameter data to the server // with each call to sqlsrv_send_stream_data. $i = 1; while( sqlsrv_send_stream_data( $stmt)) { $i++; } echo "$i calls were made."; ?> SEE ALSO
sqlsrv_prepare(3), sqlsrv_query(3). PHP Documentation Group SQLSRV_SEND_STREAM_DATA(3)
Man Page