我有連接「和」和「或」在一起的問題。 這裏是我的代碼:使用「或」和「和」正確選擇
SELECT * FROM table WHERE name LIKE '$name'
AND color LIKE '$color'
OR color2 LIKE '$color2'
OR color3 LIKE '$color3'
AND gender LIKE '$gender' -- when I add those 3, search stops working.
OR gender2 LIKE '$gender2'
OR gender3 LIKE '$gender3'
的問題是,當我添加「性別」來選擇,我的搜索停止工作......有什麼問題與雙「或」也許與定位?
正確使用括號。它就像做代數一樣,你必須把圓括號放在一起。 – developerwjk
使用括號來組合語句 –
難道你不能選擇_one_技術嗎? –