PHP/MySQL: Need reliable, flexible string search
Posted on 2012-09-18
I'm trying to come up with a search routine that's flexible enough for users to only enter a bit of a name string.
Right now I have this procedure:
SET @p1 = inSearchString;
SELECT * FROM contact
t_lastname_en LIKE CONCAT('%', @p1, '%')
t_firstname_en LIKE CONCAT('%', @p1, '%');
IN inSearchString varchar(255)
However, this only returns for a full name match with correct capitalization. (That is, "Karl" will return, but "K" or "arl" will not return. Please help!