MySQL query String contains
Solution 1:
Quite simple actually:
SELECT *
FROM `table`
WHERE `column` LIKE '%{$needle}%'
The %
is a wildcard for any characters set (none, one or many). Do note that this can get slow on very large datasets so if your database grows you'll need to use fulltext indices.
Solution 2:
Use:
SELECT *
FROM `table`
WHERE INSTR(`column`, '{$needle}') > 0
Reference:
- INSTR