pg_fetch_resultとは? わかりやすく解説

Weblio 辞書 > コンピュータ > PHP関数リファレンス > pg_fetch_resultの意味・解説 

pg_fetch_result

(PHP 4 >= 4.2.0, PHP 5)
pg_fetch_result — 結果リソースから値を返す

説明

string pg_fetch_result ( resource result, int row, mixed field )
string pg_fetch_result ( resource result, mixed field )
pg_fetch_result() は、PostgreSQL 結果リソースから 特定の行とフィールド(カラム)の値を返します。

パラメータ

result
pg_query(), pg_query_params() あるいは pg_execute() から返される PostgreSQL の クエリ結果リソース。
row
結果から取得する行の番号。行番号は 0 から始まります。指定しなかった 場合は、次の行が読み込まれます。
field
取得するフィールド(カラム)の名前を表す文字列、あるいは取得する フィールドの番号。フィールド番号は 0 から始まります。

返り値

論理型の値は "t" あるいは "f" の形式で返します。 配列を含むそれ以外の型は、PostgreSQL のやりかたにしたがって文字列として フォーマットされた形式で返します。これは psql プログラムの出力と同じ形式です。データベースの NULL 値は、NULL として返します。
row が結果の行数より大きい場合、 あるいはそれ以外のエラーが発生した場合は FALSE を返します。

例 1785. pg_fetch_result() の例
<?php
$db = pg_connect("dbname=users user=me") || die();

$res = pg_query($db, "SELECT 1 UNION ALL SELECT 2");

$val = pg_fetch_result($res, 1, 0);

echo "First field in the second row is: ", $val, "\n";
?>
上の例の出力は以下となります。

First field in the second row is: 2

    


参考

pg_query()
pg_fetch_array()




英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「pg_fetch_result」の関連用語

pg_fetch_resultのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



pg_fetch_resultのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2024 by the PHP Documentation Group.

©2024 GRAS Group, Inc.RSS