位置: 编程技术 - 正文

PHP:pg_insert()的用法_PostgreSQL函数(php insert into)

编辑:rootadmin
pg_insert

推荐整理分享PHP:pg_insert()的用法_PostgreSQL函数(php insert into),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php interpreter is not,php insteadof,php is_integer,php in,php is_integer,php insert,php insert,php insert,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4 >= 4.3.0, PHP 5)

pg_insert — 将数组插入到表中

说明 mixed pg_insert ( resource $connection , string $table_name , array $assoc_array [, int $options = PGSQL_DML_EXEC ] )

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

Warning

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的PHP 发布版本中未通知就被修改。使用本函数风险自担 。

参数

connection

PostgreSQL database connection resource.

table_name PHP:pg_insert()的用法_PostgreSQL函数(php insert into)

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');//Thisissafe,since$_POSTisconvertedautomatically$res=pg_insert($dbconn,'post_log',$_POST);if($res){echo"POSTdataissuccessfullyloggedn";}else{echo"Usermusthavesentwronginputsn";}?>

参见

pg_convert() - 将关联的数组值转换为适合 SQL 语句的格式。

PHP:pg_get_result()的用法_PostgreSQL函数 pg_get_result(PHP4=4.2.0,PHP5)pg_get_result取得异步查询结果说明resourcepg_get_result([resource$connection])pg_get_result()取得执行pg_send_query()而得到的查询结果资源。pg_send_

PHP:pg_host()的用法_PostgreSQL函数 pg_host(PHP4,PHP5)pg_host返回和某连接关联的主机名说明stringpg_host(resource$connection)pg_host()返回指定的PostgreSQLconnection资源号所连接到的主机名称。参见pg_connect

PHP:pg_last_error()的用法_PostgreSQL函数 pg_last_error(PHP4=4.2.0,PHP5)pg_last_error得到某连接的最后一条错误信息说明stringpg_last_error([resource$connection])pg_last_error()返回指定连接connection的最后一条错误信

本文链接地址:https://www.jiuchutong.com/biancheng/281480.html 转载请保留说明!

上一篇:PHP:pg_last_notice()的用法_PostgreSQL函数

下一篇:PHP:pg_get_result()的用法_PostgreSQL函数

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络