PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

sqlsrv_rows_affected - Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

sqlsrv_rows_affected

(バージョン情報なし。おそらく SVN 版にしか存在しないでしょう)

sqlsrv_rows_affectedReturns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed

説明

int sqlsrv_rows_affected ( resource $stmt )

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().

パラメータ

stmt

The executed statement resource for which the number of affected rows is returned.

返り値

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.

例1 sqlsrv_rows_affected() example

<?php
$serverName 
"serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName""UID"=>"username""PWD"=>"password" );
$conn sqlsrv_connect$serverName$connectionInfo);
if( 
$conn === false ) {
     die( 
print_rsqlsrv_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_rsqlsrv_errors(), true));
} elseif( 
$rows_affected == -1) {
      echo 
"No information available.<br />";
} else {
      echo 
$rows_affected." rows were updated.<br />";
}
?>

参考


忘却曲線を使ってこの関数を確実に記憶に残す

フォーラムで「sqlsrv_rows_affected - Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | sqlsrv_rows_affected - Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: