Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: pg_field_num - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

pg_field_prtlen" width="11" height="7"/> <pg_field_name
Last updated: Mon, 05 Feb 2007

view this page in

pg_field_num

(PHP 4 >= 4.2.0, PHP 5)

pg_field_num — 指定されたフィールドのフィールド番号を返す

説明

int pg_field_num ( resource result, string field_name )

pg_field_num() は、指定した PostgreSQL の 結果リソース(result)において field_name に相当するカラム(フィールド) のフィールド番号を返します。

注意: この関数は、以前は pg_fieldnum() と呼ばれていました。

パラメータ

result

pg_query(), pg_query_params() あるいは pg_execute() から返される PostgreSQL の クエリ結果リソース。

field_name

フィールドの名前。

返り値

フィールド番号(0 から始まります)を返します。エラー時には -1 を返します。

例 1789. フィールドの情報を取得する

<?php
  $dbconn
= pg_connect("dbname=publisher") or die("Could not connect");

 
$res = pg_query($dbconn, "select author, year, title from authors where author = 'Orwell'");
 
  echo
"Column 'title' is field number: ", pg_field_num($res, 'title');
?>

上の例の出力は以下となります。


Column 'title' is field number: 2

    

参考

pg_field_name()



add a note add a note User Contributed Notes
pg_field_num
There are no user contributed notes for this page.

pg_field_prtlen" width="11" height="7"/> <pg_field_name
Last updated: Mon, 05 Feb 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites