I would like a help to make the SQL according to the data of this figure.
What I know is that if I send AND
to all characteristics and one of them returns false
or erro
all SQL is compromised.
I thought about doing this with OR
. Is that correct? But if I do this, one of the features can be ignored, right?
Follow the code I have so far
# Essa variável pega os tipos enviados por $_GET e separá-os.
$tipos = (@explode('/', implode('/', $_GET['tipo'])));
# Esse foreach pega cada variável e monta a instrução
# **CATEGORIA LIKE '%{$word}% OR**
foreach($tipos as $word){
$sql[] = "CATEGORIA LIKE '%{$word}%'";
}
# Então SQL pega o resultado do foreach e colocar no WHERE
# e eu termino de ordenar os resultados.
$sql = 'SELECT * FROM imovel WHERE ' .implode(' OR ', $sql);
$sql .= ' ORDER BY IMO_CODIGO DESC LIMIT '.$inicio. ', '. $limite;