Jump to content

Search MySQL All Columns


jbwebdesign

Recommended Posts

hello everyone....i was wondering if someone can help me out with this.....

 

i am trying to create a search query but it doesn't seem to be working properly.....

 

i want it to search all of the columns in the database for something LIKE the posted search data.

 

here is my code....

 

$sql = "SELECT * FROM " . TABLE_NEW_SEARCH . " WHERE 
	name LIKE '%$search%' OR 
	first_name LIKE '%$search%' OR 
	last_name LIKE '%$search%' OR 
	city LIKE '%$search%' OR 
	province LIKE '%$search%' OR 
	country LIKE '%$search%' OR 
	industry LIKE '%$search%' OR 
	pro_des LIKE '%$search%' OR 
	about LIKE '%$search%' OR 
	strengths LIKE '%$search%' OR 
	orgs LIKE '%$search%' OR 
	my_website LIKE '%$search%' OR 
	about_my_company LIKE '%$search%' OR 
	program LIKE '%$search%' ORDER BY paid_membership DESC LIMIT $start, $limit";

 

for some reason this doesn't do what i'm looking for.

 

can anyone help me with this?

 

 

all i want to do is find a good way to search all the fields for something similar to the typed in phrase.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...