位置: 编程技术 - 正文

PHP:pg_update()的用法_PostgreSQL函数(php更新数据)

编辑:rootadmin
pg_update

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

文章相关热门搜索词:php deprecated,php更新数据,php

,php update,php更新数据,php实时更新时间,php更新数据,php update语句,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4 >= 4.3.0, PHP 5)

pg_update — 更新表

说明 mixed pg_update ( resource $connection , string $table_name , array $data , array $condition [, int $options = PGSQL_DML_EXEC ] )

pg_update() 用 condition 作为条件查询数据库,用 data 中的数据更新符合条件的记录。如果指定了 options,则 pg_convert() 会按照指定选项作用到 data 上。

Warning

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

参数

connection PHP:pg_update()的用法_PostgreSQL函数(php更新数据)

PostgreSQL database connection resource.

table_name

Name of the table into which to update rows.

data

An array whose keys are field names in the table table_name, and whose values are what matched rows are to be updated to.

condition

An array whose keys are field names in the table table_name, and whose values are the conditions that a row must meet to be updated.

options

Any number of PGSQL_CONV_OPTS, PGSQL_DML_NO_CONV, PGSQL_DML_EXEC 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_update() example

<?php$db=pg_connect('dbname=foo');$data=array('field1'=>'AA','field2'=>'BB');//Thisissafe,since$_POSTisconvertedautomatically$res=pg_update($db,'post_log',$_POST,$data);if($res){echo"Dataisupdated:$resn";}else{echo"Usermusthavesentwronginputsn";}?>

参见

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

PHP:pg_unescape_bytea()的用法_PostgreSQL函数 pg_unescape_bytea(PHP4=4.3.0,PHP5)pg_unescape_bytea取消bytea类型中的字符串转义说明stringpg_unescape_bytea(string$data)pg_unescape_bytea()将bytea数据类型中的字符串取消转义。

PHP:pg_tty()的用法_PostgreSQL函数 pg_tty(PHP4,PHP5)pg_tty返回该连接的tty号说明stringpg_tty(resource$connection)pg_tty()返回指定PostgreSQLconnection资源在服务器端输出调试信息的tty号。

PHP:pg_transaction_status()的用法_PostgreSQL函数 pg_transaction_status(PHP5=5.1.0)pg_transaction_statusReturnsthecurrentin-transactionstatusoftheserver.说明intpg_transaction_status(resource$connection)Returnsthecurrentin-transactionstatusoftheserv

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

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

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

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

鄂ICP备2023003026号

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

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