Guest PcGamerz13 Posted March 25, 2006 Share Posted March 25, 2006 How do yoy make it Search 5 fields and only shows Win_Tie_Lose='Win'[code]$sql5=mysql_query("SELECT * FROM clan_matches WHERE Member_1='$Member_Gamer_Tag' OR Member_2='$Member_Gamer_Tag' OR Member_3='$Member_Gamer_Tag' OR Member_4='$Member_Gamer_Tag' OR Member_5='$Member_Gamer_Tag' AND Win_Tie_Lose='Win'");[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5756-mysql-where-help/ Share on other sites More sharing options...
Barand Posted March 25, 2006 Share Posted March 25, 2006 Two ways1 ) Use "()" to separate OR's from the AND[code]SELECT * FROM clan_matches WHERE ((Member_1='$Member_Gamer_Tag') OR (Member_2='$Member_Gamer_Tag') OR (Member_3='$Member_Gamer_Tag') OR (Member_4='$Member_Gamer_Tag') OR (Member_5='$Member_Gamer_Tag')) AND Win_Tie_Lose='Win'[/code]2 ) Use "IN(list)" instead of the OR's[code]SELECT * FROM clan_matches WHERE '$Member_Gamer_Tag' IN (Member_1, Member_2,Member_3, Member_4,Member_5) AND Win_Tie_Lose='Win'[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5756-mysql-where-help/#findComment-20510 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.