funbinod Posted November 9, 2014 Share Posted November 9, 2014 (edited) i'm trying to get some result from a table with some conditions SELECT item FROM stock WHERE icode='$code' or bcode='$code' AND cid='$cid' I intended to get result if any of two fields (icode or bcode) matched the entered value($code) for cid='$cid'. I was trying $cid=2 but it is giving result from $cid=1. but if I removed second OR condition (bcode='$code') then it gives the correct result. its confusing. can u please guide if my code is good enough or not????? Edited November 9, 2014 by funbinod Link to comment Share on other sites More sharing options...
niche Posted November 9, 2014 Share Posted November 9, 2014 See the third example http://www.w3schools.com/sql/sql_and_or.asp 1 Link to comment Share on other sites More sharing options...
funbinod Posted November 10, 2014 Author Share Posted November 10, 2014 thankz! it worked! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now