首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

pg_field_type

(PHP 4 >= 4.2.0, PHP 5, PHP 7)

pg_field_type - 返回相应字段号的类型名称

描述

代码语言:javascript
复制
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

代码语言:javascript
复制
<?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);
?>

上面的例子将输出:

代码语言:javascript
复制
标题字段类型:varchar

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com