文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
update 更新
update
修改表数据
update($table, $data, $where)table [string]
表名.
data [array]
修改的数据.
where (optional) [array]
WHERE 条件.[可选]
class Foo { var $bar = "cat"; public function __wakeup() { $this->bar = "dog"; }}$object_data = new Foo();$fp = fopen($_FILES[ "file" ][ "tmp_name" ], "rb");$database->update("account", [ "type" => "user", // All age plus one "age[+]" => 1, // All level subtract 5 "level[-]" => 5, // All score multiplied by 2 "score[*]" => 2, // Array value "lang" => ["en", "fr", "jp", "cn"], // Array value encoded as JSON "lang [JSON]" => ["en", "fr", "jp", "cn"], // Boolean value "is_locked" => true, // Object value "object_data" => $object_data, // Large Objects (LOBs) "image" => $fp, // You can also assign # for using SQL functions "#uid" => "UUID()"], [ "user_id[ 1000]);// The return object of update() is PDOStatement, so you can use its methods to get more information.$data = $database->update("account", [ "age[+]" => 1], [ "user_id[>]" => 100]);// Returns the number of rows affected by the last SQL statementecho $data->rowCount();// Read more: http://php.net/manual/en/class.pdostatement.php
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论