pg_field_type
(PHP 4 >= 4.2.0, PHP 5, PHP 7)
pg_field_type - 返回相应字段号的类型名称
描述
string pg_field_type ( resource $result , int $field_number )
pg_field_type()返回一个字符串,其中包含给field_number
定PostgreSQL result
资源中给定的基本类型名称。
注意:如果该字段使用PostgreSQL域(而不是基本类型),则它是返回的域的基础类型的名称,而不是域本身的名称。
注意:这个函数被称为pg_fieldtype()。
参数
result
PostgreSQL查询结果资源,由pg_query(),pg_query_params()或pg_execute()等返回。
field_number
字段编号,从0开始。
返回值
返回包含字段类型的基本名称的字符串,或者返回FALSE
出错。
例子
Example #1 Getting information about fields
<?php
??$dbconn?=?pg_connect("dbname=publisher")?or?die("Could?not?connect");
??//?Assume?'title'?is?a?varchar?type
??$res?=?pg_query($dbconn,?"select?title?from?authors?where?author?=?'Orwell'");
??echo?"Title?field?type:?",?pg_field_type($res,?0);
?>
上面的例子将输出:
标题字段类型:varchar
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com