karimali831 Posted April 13, 2010 Share Posted April 13, 2010 Take a look at attatchment. I want to select all only from cupID 19 and (clan1 = 340 or clan2 = 340) not cupID = 19 OR clan2 = 340 only clan1 = 340 or clan2 = 340 anyway? thanks for help. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/198371-whats-wrong-with-my-query/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 13, 2010 Share Posted April 13, 2010 You wrote the answer in your question - cupID 19 and (clan1 = 340 or clan2 = 340) WHERE cupID = 19 and (clan1 = 340 or clan2 = 340) Link to comment https://forums.phpfreaks.com/topic/198371-whats-wrong-with-my-query/#findComment-1040905 Share on other sites More sharing options...
ChemicalBliss Posted April 13, 2010 Share Posted April 13, 2010 Use parenthesis to seperate arguments. Im sure it works: SELECT * FROM `...` WHERE (`cupID`='19') AND (`clan2`='340' OR `clan1`='340'); -CB- Link to comment https://forums.phpfreaks.com/topic/198371-whats-wrong-with-my-query/#findComment-1040906 Share on other sites More sharing options...
karimali831 Posted April 13, 2010 Author Share Posted April 13, 2010 Lol ok thanks very much. Works Link to comment https://forums.phpfreaks.com/topic/198371-whats-wrong-with-my-query/#findComment-1040911 Share on other sites More sharing options...
karimali831 Posted April 14, 2010 Author Share Posted April 14, 2010 what about if I wanted to use this: if(memin($userID,($teamid ||$oppid))) $variable = ''; else $variable = ''; I know that's wrong.. I want $userID and ($teamid or $oppid) I thought if(memin($userID,$teamid,$oppid)) may of worked but didn't. If I just used $teamid or $oppid it won't get all so I need to use both. Link to comment https://forums.phpfreaks.com/topic/198371-whats-wrong-with-my-query/#findComment-1041561 Share on other sites More sharing options...
karimali831 Posted April 14, 2010 Author Share Posted April 14, 2010 This does work if(memin($userID,$teamid)) $variable = ''; elseif(memin($userID,$oppid)) $variable = ''; else $variable = ''; Link to comment https://forums.phpfreaks.com/topic/198371-whats-wrong-with-my-query/#findComment-1041570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.