views:

284

answers:

1

Hello, actually i use this method to show similar words for a search request..

$query = "SELECT * FROM searches WHERE Query LIKE '%$search%' ORDER BY Query"; 

if someone searches for "nelly" it looks up in the database for similar words

"nelly furtado, nelly ft. kelly"...

but i dont want to show up the searched word..

example: you've searched for nelly - try this too: nelly, nelly furtado, nelly ft.,

the bold word should not showed up again, because it's the searched word.. is there maybe a method with MATCH AGAINST? thank you!

+5  A: 

Couldn't you just do something like ...WHERE Query LIKE "%$search%' AND Query <> '$search'...?

Case-insensitive: Query LIKE "%$search%' AND STRCMP(Query, '$search') == 0

Benjamin Manns
thank you, great!
elmaso
Did it work for you? I tried this query and Nelly is still in the result...
Leniel Macaferi
@Leniel Macaferi, I think this may be due to case sensitivity. I have updated the query to reflect a case-insensitive search.
Benjamin Manns
Oh sorry. It works. I typed the query incorrectly. The query I tried was this: SELECT * FROM searches WHERE search LIKE '%nelly%' ORDER BY search andsearch <> 'nelly'; hehehe :)
Leniel Macaferi