Jump to content

How to get a PHP Search form to suggest alternatives in MySQL database?


Recommended Posts

Does anyone know a function or way that I can get my php search form to suggest alternatives when zero results are returned?

 

Ideally it would look through the database column that has just been searched and suggest some records that are close to what was typed... is this possible?

 

 

well i think you need some hardcore regular expressions for this and a table with keywords. otherwise I would have no idea how to do this.

I think this is pretty difficult.

Might be possible by shortening down the term they where searching for multiple ways and then search with an extensive "OR" list in either keyword table or directly in the text, not that this would probably strain your mysql database a lot (even with great indexing).

Might be possible by shortening down the term they where searching for multiple ways and then search with an extensive "OR" list in either keyword table or directly in the text, not that this would probably strain your mysql database a lot (even with great indexing).

 

instead of OR you could use REGEX in an sql query too.

Might be possible by shortening down the term they where searching for multiple ways and then search with an extensive "OR" list in either keyword table or directly in the text, not that this would probably strain your mysql database a lot (even with great indexing).

 

instead of OR you could use REGEX in an sql query too.

 

Yes but if im not misstaking regexp search slower, but then again would be a lot of ORs so might be faster with regexp search... Anyway he should test what works best and run with that..=)

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.