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

Popular posts from this blog

java - unable show chart in xls document using jasper reports -

javascript - How to change image src on success AJAX -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -