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

sqlsrv_next_result - Makes the next result of the specified statement active | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

sqlsrv_next_result

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

sqlsrv_next_resultMakes the next result of the specified statement active

説明

mixed sqlsrv_next_result ( resource $stmt )

Makes the next result of the specified statement active. Results include result sets, row counts, and output parameters.

パラメータ

stmt

The statment on which the next result is being called.

返り値

Returns TRUE if the next result was successfully retrieved, FALSE if an error occurred, and NULL if there are no more results to retrieve.

例1 sqlsrv_next_result() example

The following example executes a batch query that inserts into a table and then selects from the table. This produces two results on the statement: one for the rows affected by the INSERT and one for the rows returned by the SELECT. To get to the rows returned by the SELECT, sqlsrv_next_result() must be called to move past the first result.

<?php
$serverName 
"serverName\sqlexpress";
$connectionInfo = array("Database"=>"dbName""UID"=>"userName""PWD"=>"password");
$conn sqlsrv_connect$serverName$connectionInfo);

$query "INSERT INTO Table_1 (id, data) VALUES (?,?); SELECT * FROM TABLE_1;";
$params = array(1"some data");
$stmt sqlsrv_query($conn$query$params);

// Consume the first result (rows affected by INSERT) without calling sqlsrv_next_result.
echo "Rows affected: ".sqlsrv_rows_affected($stmt)."<br />";

// Move to the next result and display results.
$next_result sqlsrv_next_result($stmt);
if( 
$next_result ) {
   while( 
$row sqlsrv_fetch_array$stmtSQLSRV_FETCH_ASSOC)){
      echo 
$row['id'].": ".$row['data']."<br />"
   }
} elseif( 
is_null($next_result)) {
     echo 
"No more results.<br />";
} else {
     die(
print_r(sqlsrv_errors(), true));
}
?>

参考


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

フォーラムで「sqlsrv_next_result - Makes the next result of the specified statement active」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | sqlsrv_next_result - Makes the next result of the specified statement active」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: