Ignoring white space on MySQL LIKE statement
Posted on 2007-03-21
I have a search page feature on my website (PHP & MySQL 5). At the moment i am using SELECT * FROM table WHERE somefield LIKE '%keywords%'
The problem is the search became really sensitive when it comes to whitespace. Say if i want to search for "Radio A", i have to put "Radio A" for the search to find the record. When someone put "RadioA" (Without spaces) it wont find any results.
I dont want to explode "Radio A" into "Radio" and "A", as it will return any other "Radio" results which we dont want.
Any hints and tips would be appreciated.