I need to check if a string is found in one or more columns.
Basically, I have a program which lets you checks multiple fields (name, surname, etc...)
If both name and surname are checked and the user enters just the name, for example chris it would be easy to check it in mySQL with the LIKE parameter like this:
select * from tblClients WHERE name LIKE '%john%';
select * from tblClients WHERE (name or surname) LIKE '%john%';
Can't you just use separate WHERE clauses, such as:
SELECT * FROM tblClients WHERE (name LIKE '%john%') OR (surname LIKE '%john%')
You're having to amend the SQL based on which columns the user selects anyway.