php - Mysql search fields different order -


i have table this

name  | surname   | email         | tel edwin | williams  | edwin@aa.com  | 123456 luke  | evan      | luke@bb.com   | 987456 

i need search "edwin williams" or "williams edwin" same.

i tried

concat_ws (' ', name, surname, email, email2) '%".addslashes($_post['search'])."%' or concat_ws (' ', surname, name, email, email2) '%".addslashes($_post['search'])."%' 

but don't it, in search "123456 edwin" don't find anything.

i have table in innodb, prefer not use myisam fulltext.

i think want:

where concat_ws(' ', name, surname, email, email2, tel) regexp replace(concat('%', $_post['search'], '%'), ' ', '|') 

you want vertical bar "or" regular expression.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -