(PHP 4 >= 4.3.0, PHP 5, PHP 7)
pg_insert — ��������뵽����
$connection
, string $table_name
, array $assoc_array
[, int $options
= PGSQL_DML_EXEC
] ) : mixed
pg_insert() �� assoc_array
�����е�ֵ���뵽��
table_name
ָ���ı��С�
��������˲���
options
������ pg_convert()
�ᰴ�ո���ѡ����õ� assoc_array
��
�˺�����ʵ�����ġ��˺����ı��������Ƽ�������ĵ���������δ���� PHP �����汾��δ֪ͨ�ͱ��ġ�ʹ�ñ����������Ե� ��
connection
PostgreSQL database connection resource.
table_name
Name of the table into which to insert rows. table_name
�е��б�������Ҫ�� assoc_array
�еĵ�Ԫ��ô�ࡣ
assoc_array
table_name �е��ֶ����Լ��ֶ�ֵ����� array ���� �еļ�����ֵƥ�䡣
options
Any number of PGSQL_CONV_OPTS
,
PGSQL_DML_NO_CONV
,
PGSQL_DML_EXEC
,
PGSQL_DML_ASYNC
or
PGSQL_DML_STRING
combined. If PGSQL_DML_STRING
is part of the
options
then query string is returned.
�ɹ�ʱ���� TRUE
�� ������ʧ��ʱ���� FALSE
�� Returns string if PGSQL_DML_STRING
is passed
via options
.
Example #1 pg_insert() example
<?php
$dbconn = pg_connect('dbname=foo');
// This is safe, since $_POST is converted automatically
$res = pg_insert($dbconn, 'post_log', $_POST);
if ($res) {
echo "POST data is successfully logged\n";
} else {
echo "User must have sent wrong inputs\n";
}
?>