目录

update 更新

优质
小牛编辑
119浏览
2023-12-01

update

修改表数据

update($table, $data, $where)
  • table [string]

    表名.

  • data [array]

    修改的数据.

  • where (optional) [array]

    WHERE 条件.[可选]

Return: [number] 受影响的行数.你可以修改没有序列化的数组, 并且能使用 [+], [-], [*], [/] 来做运算
$database->update("account", [    "type" => "user",    // All age plus one    "age[+]" => 1,    // All level subtract 5    "level[-]" => 5,    // All score multiplied by 2    "score[*]" => 2,    // Like insert, you can assign the serialization    "lang" => ["en", "fr", "jp", "cn", "de"],    "(JSON) fav_lang" => ["en", "fr", "jp", "cn", "de"],    // You can also assign # for using SQL functions    "#uid" => "UUID()"], [    "user_id[ 1000]);