即時特林在發現(「所有」蛋糕上輸入一些條件,這是我的邏輯:多重條件的所有
Traduction.traductions = my username AND Traduction.status = 1 OR 8
OR, Traduction.check1 = my username AND Traduction.status = 5 OR 2
OR, Traduction.check2 = my username AND Traduction.status = 6 OR 3
Or, Trauduction.editions = my username AND Traduction.status = 7 OR 3
如果這些條件一個是正確的,他顯示的內容
這是我到目前爲止的代碼
$conditions = array(
'AND' => array(
array(
'OR' => array(
array('Traduction.traductions' => $this->Session->read('Auth.User.username')),
array('Traduction.status' => '1'),
array('Traduction.status' => '8')
)
),
'AND' => array(
array(
'OR' => array(
array('Traduction.check1' => $this->Session->read('Auth.User.username')),
array('Traduction.check1' => '5'),
array('Traduction.check1' => '2')
)
)
),
'AND' => array(
array(
'OR' => array(
array('Traduction.check2' => $this->Session->read('Auth.User.username')),
array('Traduction.check2' => '6'),
array('Traduction.check2' => '3')
)
)
),
'AND' => array(
array(
'OR' => array(
array('Traduction.edition' => $this->Session->read('Auth.User.username')),
array('Traduction.edition' => '7'),
array('Traduction.edition' => '4')
)
)
),
)
);
$traduction = $this->Traduction->find('all', array(
'conditions' => $conditions
));
但遺憾的是它似乎不工作。這裏德SQL轉儲
SELECT `Traduction`.`id`, `Traduction`.`serie`, `Traduction`.`issue`,
`Traduction`.`page`, `Traduction`.`writer`, `Traduction`.`drawer`,
`Traduction`.`release`, `Traduction`.`traductions`, `Traduction`.`check1`,
`Traduction`.`check2`, `Traduction`.`edition`, `Traduction`.`user_name`,
`Traduction`.`content`, `Traduction`.`status` FROM
`dcomicstrad`.`traductions` AS
`Traduction` WHERE ((((`Traduction`.`traductions` = 'DrWhat')
OR (`Traduction`.`status` = 1)
OR (`Traduction`.`status` = 8)))
AND (((`Traduction`.`edition` = 'DrWhat')
OR (`Traduction`.`edition` = '7')
OR (`Traduction`.`edition` = '4'))))
是否有人可以幫助我,我有點所有這些陣列丟失X_X
簡單地說*不*工作並不能使我們理解你的問題....請指定你面臨什麼問題,或者你得到什麼錯誤 –
你可以在cakephp中多重條件檢查這個例子http://goo.gl/OvDt4b – Sudhir