php man page for sqlsrv_rows_affected

Query: sqlsrv_rows_affected

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

SQLSRV_ROWS_AFFECTED(3) 												   SQLSRV_ROWS_AFFECTED(3)

sqlsrv_rows_affected - Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed

SYNOPSIS
int sqlsrv_rows_affected (resource $stmt)
DESCRIPTION
Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed. For information about the number of rows returned by a SELECT query, see sqlsrv_num_rows(3).
PARAMETERS
o $stmt - The executed statement resource for which the number of affected rows is returned.
RETURN VALUES
Returns the number of rows affected by the last INSERT, UPDATE, or DELETE query. If no rows were affected, 0 is returned. If the number of affected rows cannot be determined, -1 is returned. If an error occurred, FALSE is returned.
EXAMPLES
Example #1 sqlsrv_rows_affected(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 = ?"; $params = array("updated data", 1); $stmt = sqlsrv_query( $conn, $sql, $params); $rows_affected = sqlsrv_rows_affected( $stmt); if( $rows_affected === false) { die( print_r( sqlsrv_errors(), true)); } elseif( $rows_affected == -1) { echo "No information available.<br />"; } else { echo $rows_affected." rows were updated.<br />"; } ?>
SEE ALSO
sqlsrv_num_rows(3). PHP Documentation Group SQLSRV_ROWS_AFFECTED(3)
Related Man Pages
sqlsrv_connect(3) - php
sqlsrv_send_stream_data(3) - php
sqlsrv_execute(3) - php
sqlsrv_get_field(3) - php
sqlsrv_free_stmt(3) - php
Similar Topics in the Unix Linux Community
Optimizing query
Return rows from Oracle package
Script which will run every 10minutes and Send SMS to mobile
Remove some special ascii character
Shell script to call sql file