PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<pg_fetch_rowpg_field_name>
Last updated: Mon, 16 Jul 2012

pg_field_is_null

(PHP 4 >= 4.2.0, PHP 5)

pg_field_is_null -- 测试字段是否为 NULL

说明

int pg_field_is_null ( resource result, int row, mixed field )

pg_field_is_null() 测试字段是否为 NULL。如果字段在给出的行中为 NULL 则返回 1,如果字段在给出的行中不是 NULL 则返回 0。字段可以以列的索引号(数字)方式给出,也可以以字段名(字符串)方式给出。行的编号从 0 开始。

例子 1. pg_field_is_null() 例子

<?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";
     }
   }
?>

注: 本函数以前的名字为 pg_fieldisnull()




<pg_fetch_rowpg_field_name>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST