版本: 1.1.3
replace
替换旧数据到新数据
replace($table, $column, $search, $replace, $where)
table [string]
表名称。
columns [string/array]
将要替换数据的目标字段列表。
search [string]
将要搜索的值。
replace [string]
将搜索到的值替换成的值。
where (可选) [array]
过滤记录的 WHERE 子句。
replace($table, $column, $replacement, $where)
table [String]
表名称。
columns [string/array]
将要替换数据的目标字段列表。
replacement [array]
替换的数组值,键(key)为搜索的值,值(value)为替换成的值。
where (可选) [array]
过滤记录的 WHERE 子句。
replace($table, $columns, $where)
table [string]
表名称。
columns [array]
将要替换数据的目标字段列表。
where (optional) [array]
过滤记录的 WHERE 子句。
返回: [number] 受影响的行数。
$database->replace("account", "type", "user", "new_user", [
"user_id[>]" => 1000
]);
$database->replace("account", "type", [
"user" => "new_user",
"business" => "new_business"
], [
"user_id[>]" => 1000
]);
$database->replace("account", [
"type" => [
"user" => "new_user",
"business" => "new_business"
],
"group" => [
"groupA" => "groupB"
]
], [
"user_id[>]" => 1000
]);
