I looked for answers here in the community but found nothing specific. I have a page where I can search the names of clients previously registered in a MySQL database. I am currently using the following statements:
PHP: $valor = str_replace(' ', '%', $pesquisa);
SQL: "select * from user where nome like '%".$valor."%' order by nome asc;"
Being PHP variable $ search , comes from a search form on the same page. (The above code allows me to do searches with more than one value). For example, if there is a client in the database named Luiz Henrique da Silva , and I search for Luiz , Luiz Henrique , or even Luiz Silva , this code will work perfectly, listing that user.
However, if I search the name out of order, such as Silva Henrique , or da Silva Luiz , the user will not be listed. How could you enable this reverse search in a simple way?