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($res0"year") == 1) {
            echo 
"The value of the field year is null.\n";
        }
        if (
pg_field_is_null($res0"year") == 0) {
            echo 
"The value of the field year is not null.\n";
      }
   }
?>

注: 本函數以前的名字為 pg_fieldisnull()