Jump to content

MySQL Select Query


springmedia

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

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.