$database->update($campaign_table, $data_nga_posti , array("AND" => ["codice_pod" => $data_nga_posti['codice_pod'],("codice_pdr" =>NULL) ]));
所以这是我的查询执行时:
UPDATE `field` SET `columnname` = 'data',`anothercm` = 'data',WHERE `codice_pod` = 'IT001E35563561' AND `codice_pdr` IS NULL
我希望我的查询看起来像这样。
UPDATE `field` SET `columnname` = 'data',`anothercm` = 'data',WHERE `codice_pod` = 'IT001E35563561' AND (`codice_pdr` IS NULL OR `codice_pdr` ="")
但我不知道如何将OR(运算符)放在此代码中。
非常感谢!
答案 0 :(得分:2)
我以前从未使用过此版本,并且无需测试,但the documentation中发布的封闭示例为:
$database->has("account", [
"AND" => [
"OR" => [
"user_name" => "foo",
"email" => "foo@bar.com"
],
"password" => "12345"
]
]);
所以我觉得这对你有用:
$database->update($campaign_table, $data_nga_posti, [
"AND" => [
OR => [
"codice_pdr" =>NULL,
"codice_pdr" => ""
],
"codice_pod" => $data_nga_posti['codice_pod']
]
]);
答案 1 :(得分:0)
试试这个:
array("AND" => ["codice_pod" => $data_nga_posti['codice_pod'],"OR" => ["codice_pdr" =>NULL,`codice_pdr` ="" ] ])