= 4.2.0, PHP 5, PHP 7, PHP 8)pg_field_is_null — 測試字段是否為 null說明pg_field_is_null(resource $result, int $row, mixed $field): intp">

pg_field_is_null

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

pg_field_is_null測試字段是否為 null

說明

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

pg_field_is_null() 測試字段是否為 null。如果字段在給出的行中為 null 則返回 1,如果字段在給出的行中不是 null 則返回 0。字段可以以列的索引號(數(shù)字)方式給出,也可以以字段名(字符串)方式給出。行的編號從 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";
      }
   }
?>

注意:

本函數(shù)以前的名字為 pg_fieldisnull()