嘿伙计们(这是我的第一个问题).我今天遇到了一些问题因此,我需要一些帮助.
我的代码看起来像这样:
$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(运算符)放在此代码中.
非常感谢你!
最佳答案 我之前从未使用过这个版本,并且无需测试,但
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']
]
]);