Jump to content

Recommended Posts

Hey so the issue that I have is, I am trying to remove a SQL value from a user entered value.

 

For example, is a user types in red Ford Mustang, it should remove 'red' from the search because Ford Mustang is equal to something the user typed and something which is in the database.

 

I have tried the preg match, chop, str_remove, trim functions and they don't seem to work.

 

please help :)

I'm going to try to interpret what you want. 

 

What you're looking for is a full text index capability. 

 

Full text allows you to find phrases or portions of phrases inside text.

 

Standard text indexes really don't support this without at very least, doing tablescans.

 

MySQL does have fulltext indexes, with some caveats in terms of their availabiitity given a mysql engine or version.

 

There are a number of fulltext engines like sphinx, elastic search and Lucene.  PHP has support for all these engines through third party libraries.   Most sophisticated sites have tended to use full text engines, due to the many available features, but you should probably read up on the mysql full text system to see if that will work for you as it will be faster and easier for you to setup if you already are using mysql.

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.