mysql - Select data which contains value in 1 of 4 columns -
i want select rows contain value of variable '$filter_objekt' in sql column 'objekt1' or 'objekt2' or 'objekt3' or 'objekt4'.
this current query:
$filter_objekt = "lorem"; $ergebnis = mysqli_query($db, "select * aktionen jahr '$filter_jahr' , kunde '$filter_kunde' , kampagne '$filter_kampagne' , objekt1 '$filter_objekt' or objekt2 '$filter_objekt' or objekt3 '$filter_objekt' or objekt4 '$filter_objekt' or mediamix '$filter_mediamix' , kosten '$filter_kosten' , schulnote '$filter_schulnote' , feedback_status '$filter_feedback' order kunde asc, aktionsname asc");
at moment script returns every row of table, no matter if contains value of '$filter_objekt' or not.
any highly appreciated. in advance!
you have add set of 4 or's block parentheses
select * aktionen jahr '$filter_jahr' , kunde '$filter_kunde' , kampagne '$filter_kampagne' , (objekt1 '$filter_objekt' or objekt2 '$filter_objekt' or objekt3 '$filter_objekt' or objekt4 '$filter_objekt') , mediamix '$filter_mediamix' , kosten '$filter_kosten' , schulnote '$filter_schulnote' , feedback_status '$filter_feedback' order kunde asc, aktionsname asc
note changed or after objekt4 and.
Comments
Post a Comment