Jump to content

Search string


pwes24

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/100091-search-string/
Share on other sites

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%'"; 

Link to comment
https://forums.phpfreaks.com/topic/100091-search-string/#findComment-511891
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.