pg_update

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

pg_update

(PHP 4 >= 4.3.0)

pg_update -- 更新表

說明

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

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

例子

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

}

?>

相關詞條

熱門詞條

聯絡我們