= 4.2.0, PHP 5, PHP 7, PHP 8)pg_affected_rows — 返回受影響的記錄數(shù)目說明pg_affected_rows(resource $result): intpg_affected_rows() 返回在 pg_q">

pg_affected_rows

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

pg_affected_rows返回受影響的記錄數(shù)目

說明

pg_affected_rows(resource $result): int

pg_affected_rows() 返回在 pg_query() 中執(zhí)行 INSERT,UPDATE 和 DELETE 查詢后受到影響的記錄數(shù)目(包括實例/記錄/行)。如果本函數(shù)沒有影響到任何記錄,則返回 0。

示例 #1 pg_affected_rows() 例子

<?php
$result 
pg_query($conn"INSERT INTO authors VALUES ('Orwell', 2002, 'Animal Farm')");
$cmdtuples pg_affected_rows($result);
echo 
$cmdtuples " tuples are affected.\n";
?>

注意:

本函數(shù)以前被稱為 pg_cmdtuples()。

參見 pg_query()pg_num_rows()。