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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.