mcmuney Posted October 5, 2006 Share Posted October 5, 2006 I need to make the where statement below and make it where the reverse is also possible, can someone help with rewriting the statement. It basically needs to be WHERE x=1 AND y=2 OR x=2 AND y=1 (it should look for either of these possibilities):[code]$query="select * from `sc_friend` where (scf_mem_id={$R}) and (scf_frnd_id={$social_mem_id})";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23125-andor-function/ Share on other sites More sharing options...
markbett Posted October 5, 2006 Share Posted October 5, 2006 where (((scf_mem_id={$R}) and (scf_frnd_id={$social_mem_id}) OR ((scf_mem_id={$R}) and (scf_frnd_id={$social_mem_id} ))The section before and after teh OR are the same cause i dont understand what you are doing but that will work when you get the right stuff after the or Quote Link to comment https://forums.phpfreaks.com/topic/23125-andor-function/#findComment-104695 Share on other sites More sharing options...
HuggieBear Posted October 5, 2006 Share Posted October 5, 2006 Something like this should work...[code=php:0]$query="SELECT * FROM `sc_friend` WHERE (x = 1 AND y = 2) OR (x = 2 AND y= 1)";[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23125-andor-function/#findComment-104697 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.