pwes24 Posted April 8, 2008 Share Posted April 8, 2008 Hello, I have this website where people can search for jobs. The problem is I don't know how to use the LIKE syntax and others like WHERE `column`=$myVal. Here's my code so far. I'd like to search using more variables. How do I do this? $squery = "SELECT * FROM `jobpost` WHERE `city`='.$city.' `title` LIKE '%$keyword%' "; I'd also like to search with additional variables like state, industry. Thank you. Quote Link to comment Share on other sites More sharing options...
uniflare Posted April 8, 2008 Share Posted April 8, 2008 $squery = "SELECT * FROM `jobpost` WHERE `city`='.$city.' OR `title` LIKE '%$keyword%' OR `industry` LIKE '%$keyword%'"; use OR to join/add extra search queries. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 8, 2008 Share Posted April 8, 2008 Or use AND if you want both critera to be met. Also, those periods aren't wanted. You use those when joining strings together, but you're not doing that here: $squery = "SELECT * FROM `jobpost` WHERE `city`='$city' OR `title` LIKE '%$keyword%' OR `industry` LIKE '%$keyword%'"; Quote Link to comment Share on other sites More sharing options...
pwes24 Posted April 8, 2008 Author Share Posted April 8, 2008 Thank you everyone. Advice was helpful. 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.