Jump to content

Recommended Posts

Hi there people, just wondering if you could help me out I am having a problem with creating my select statement.

 

$term = $_POST['term'];

$sql2 = mysql_query("SELECT * FROM members WHERE '$term%' IN(location1,location2,location3,location4,location5)");

 

basically I am after a search from form post $term to return all matching values from the columns "location1" through to location5.

 

I am not sure if I am going the right way about this but any help would be appreciated.

 

Kind Regards,

 

Rich

Link to comment
https://forums.phpfreaks.com/topic/238468-mysql-select-query/
Share on other sites

Thank you requinix, I can't believe I didn't see that.  Guess I have been looking at this code for too long.  The main reason is for a business profile search.  1 business profile can appear in multiple locations around the country if assigned a location prefix.  Saves making multiple profiles for the business.

 

Thanks again,

 

Kind regards,

 

Rich

Link to comment
https://forums.phpfreaks.com/topic/238468-mysql-select-query/#findComment-1225418
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.