ted_chou12 Posted January 29, 2007 Share Posted January 29, 2007 Can anyone suggest me, give me an example with the use of OR in mysql query?ThanksTed Quote Link to comment Share on other sites More sharing options...
trq Posted January 29, 2007 Share Posted January 29, 2007 [code]SELECT foo FROM bar WHERE foo = 'bob' OR foo = 'boo';[/code]or[code]SELECT foo FROM bar WHERE foo = 'bob' || foo = 'boo';[/code] Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 29, 2007 Author Share Posted January 29, 2007 I tried this:$query_count = "SELECT * FROM friendlist WHERE username='$username' AND status='pending' OR status='declined'"and it doesnt work, is it because of the way i organised it?Ted Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 29, 2007 Author Share Posted January 29, 2007 sorry, my bad... i think it works...Ted Quote Link to comment Share on other sites More sharing options...
trq Posted January 29, 2007 Share Posted January 29, 2007 You should group it within braces.[code]$query_count = "SELECT * FROM friendlist WHERE username='$username' AND (status='pending' OR status='declined')";[/code] Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 29, 2007 Author Share Posted January 29, 2007 Thanks ;D Quote Link to comment 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.