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

sqlsrv_get_field - Gets field data from the currently selected row | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

sqlsrv_get_field

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

sqlsrv_get_fieldGets field data from the currently selected row

説明

mixed sqlsrv_get_field ( resource $stmt , int $fieldIndex [, int $getAsType ] )

Gets field data from the currently selected row. Fields must be accessed in order. Field indices start at 0.

パラメータ

stmt

A statement resource returned by sqlsrv_query() or sqlsrv_execute().

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.

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.

返り値

Returns data from the specified field on success. Returns FALSE otherwise.

例1 sqlsrv_get_field() example

The following example demonstrates how to retrieve a row with sqlsrv_fetch() and get the row fields with sqlsrv_get_field().

<?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 "SELECT Name, Comment 
        FROM Table_1
        WHERE ReviewID=1"
;
$stmt sqlsrv_query$conn$sql);
if( 
$stmt === false ) {
     die( 
print_rsqlsrv_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_rsqlsrv_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$stmt0);
echo 
"$name: ";

$comment sqlsrv_get_field$stmt1);
echo 
$comment;
?>

参考


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

フォーラムで「sqlsrv_get_field - Gets field data from the currently selected row」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | sqlsrv_get_field - Gets field data from the currently selected row」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: