pg_update

(PHP 4 >= 4.3.0, PHP 5)

pg_update --  更新表

說明

mixed pg_update ( resource connection, string table_name, array data, array condition [, int options] )

pg_update()condition 作為條件查詢資料庫,用 data 中的資料更新符合條件的記錄。若果指定了 options,則 pg_convert() 會按照指定選項作用到 data 上。

例子 1. pg_update

<?php 
    $db 
pg_connect ('dbname=foo');
    
$data = array('field1'=>'AA''field2'=>'BB');
    
// This is safe, since $_POST is converted automatically
    
$res pg_update($db'post_log'$_POST$data);
    if (
$res) {
        echo 
"Data is updated: $res\n";
    }
    else {
        echo 
"User must have sent wrong inputs\n";
    }
?>

警示

本函數是實驗性的。本函數的行為,內含函數名稱以及其它任何關於本函數的文件可能會在沒有知會的情況下隨 PHP 以後的發佈而改變。使用本函數風險自擔。

參見 pg_convert()