MySQL
+----+-------------------+----------+--------------+
| id | address | city | state |
+----+-------------------+----------+--------------+
| 1 | 13000 highway 244 | keystone | south dakota |
+----+-------------------+----------+--------------+
(btw, I left out some columns to make it easier)
PHP
$string = mysql_real_escape_string('13000 highway 244 south dakota');
$a = mysql_query("
SELECT * FROM `table` WHERE
CONCAT_WS(' ', `address`, `city`, `state`) LIKE '%$string%'
");
The above search query doesn't return any results, only the following values
would work:
- 13000 highway 244 keystone south dakota
- 13000 highway 244 keystone
- keystone south dakota
However, I also want to get the following values
to work:
- 13000 highway 244 south dakota
- 13000 highway keystone
- south dakota highway keystone
- etc.
Is that even possible without relying on full-text search
?