How to search for records that fit into any category of a list, even if the category name only partially matches?

Asked

Viewed 84 times

1

I have this instruction:

$nova   = (explode('/', implode('/', $_GET['tipo'])));

Which results in this array:

Array
(
    [0] => CONJUNTO
    [1] => SALA
    [2] => LOJA
)

When I do this query in my database ...

$sql = "SELECT * FROM imovel WHERE CATEGORIA IN ('".implode("','", $nova)."')";

... it returns me only the results of LOJA and I know why, for the reason that CONJUNTO and SALA are within a single string, so: CONJUNTO/SALA, then as he seeks instruction exact does not bring me these results.

One of the SQL statements allows it to also bring me results containing these indexes by approximate comparison that for this case will be perfect.

Help me apply this instruction to that $sql??

  • One step is to define this "approximate".

1 answer

3

Browser other questions tagged

You are not signed in. Login or sign up in order to post.