pg_insert

(PHP 4 >= 4.3.0)

pg_insert --  将数组插入到表中

说明

bool pg_insert ( resource connection, string table_name, array assoc_array [, int options])

pg_insert() 将具有 field=>value 结构的数组 assoc_array 插入到由 table_name 指定的表中。如果给出了参数 options ,则函数 pg_convert() 会按照给定选项被作用到 assoc_array 上。

例子 1. pg_insert

<?php 
    $db = pg_connect ('dbname=foo');
    // This is safe, since $_POST is converted automatically
    $res = pg_insert($db, 'post_log', $_POST);
    if ($res) {
        echo "POST data is succesfully logged\n";
    }
    else {
        echo "User must have sent wrong inputs\n";
    }
?>

注: 本函数为试验性质。

参见 pg_convert()