I'm familiar with LIKE...I was considering using MySQL's full text search functions which use MATCH and AGAINST.
It's a bit complicated with LIKE but I have some ideas. I was imagining that if I was trying to match against some $name, i would:
- explode $name along whitespace
- trim each chunk
- drop common useless words like the/and/of and punctuation
- construct a LIKE query from the remaining words
thus, 'david geffen company' would break into an array much like this one
$words = array('david', 'geffen', 'company');
and i might make my query something like this:
$sql = "SELECT * FROM table WHERE name LIKE '%" . implode('%', $words) . "%'";
// SELECT * FROM table WHERE name LIKE '%david%geffen%company%'
HOWEVER, in that approach order is important and all non-trival words must be matched. That would mean these two potential matches would not be caught:
Corporation for Public Broadcasting
Public Broadcasting, Inc.
or perhaps:
Universal Music, Inc.
Vivendi Universal
It seemed to me that writing all the code to construct every combination and permutation of the words in a name would be time-consuming and result in a horribly inefficient and nasty query. I was really hoping for a better way.