sql - Search multiple rows by space with PHP/MySQL -
i making search searches sql table multiple rows. example:
| firstname | lastname | |----------------------| | john | doe | |----------------------|
select firstname,lastname users firstname '%inputhere%' or lastname '%inputhere%' limit 10
when search full name (e.g. john doe
) no results appear because no 1 row has value.
i there way separate search query spaces in order avoid this?
similar gordon said, best solution use full text indexes. however, can this:
select * users concat(firstname, " ", lastname) "john doe"
you can feel free turn "john doe"
"%john doe%"
or "john doe%"
.
try here: http://sqlfiddle.com/#!9/d0042/5/0
Comments
Post a Comment