HI

can someone help me with general search syntax.

I want to search a table with a search string obtained from a form input
( PHP/Mysql app)

The problem is:

Lets say there is an entry in the table: "John Doe"

When I search for that, with something like:

select * from table where name like '%$name%' it generally works fine,
BUT, when they make a typo, something like "John Do", it doesn't return
a result.

What is the best way of searching through a table to ensure the "best"
possible hit?

I thought of splitting the $name search string into the seperate words
"john" and "doe" and then searching for both with a like'%%', and then
combining the result of both as the result for the search, but I was
hoping there might be a "better" way to do this, specially if the search
string contains only one word.

So, I would like the results to be rather "relaxed", if they search for
johnn, it should return john as well as a posibility.

Hope this won't be too complicated to do.

sql, query




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to