pg_field_is_null
(PHP 4 >= 4.2.0, PHP 5, PHP 7)
pg_field_is_null - 测试一个字段是否为SQL NULL
描述
int pg_field_is_null ( resource $result , int $row , mixed $field )
int pg_field_is_null ( resource $result , mixed $field )
pg_field_is_null()测试PostgreSQL结果资源中的字段是否为SQL NULL。
注意:这个函数过去被称为pg_fieldisnull()。
参数
result
PostgreSQL查询结果资源,由pg_query(),pg_query_params()或pg_execute()等返回。
row
结果中的行号用于提取。行从0开始编号。如果省略,则取出当前行。
field
字段编号(从0开始)作为整数或字段名称作为字符串。
返回值
如果给定行中的字段为SQL NULL,则返回1;否则返回0。如果行超出范围或出现任何其他错误,则返回。FALSE
例子
Example #1 pg_field_is_null() example
<?php
??$dbconn?=?pg_connect("dbname=publisher")?or?die?("Could?not?connect");
??$res?=?pg_query($dbconn,?"select?*?from?authors?where?author?=?'Orwell'");
??if?($res)?{
??????if?(pg_field_is_null($res,?0,?"year")?==?1)?{
??????????echo?"The?value?of?the?field?year?is?null.\n";
??????}
??????if?(pg_field_is_null($res,?0,?"year")?==?0)?{
??????????echo?"The?value?of?the?field?year?is?not?null.\n";
????}
?}
?>
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com