I want to create a search engine and I'm having some problems. This is my code:
SELECT COUNT(*) as num FROM `offerta` WHERE `text` LIKE '%".$sea."%' AND `regione`='$re'
Now it works. I want to search on several columns and filter results by category (regione
).
SELECT COUNT(*) as num FROM `offerta` WHERE `titolo` LIKE '%".$sea."%' OR `text` LIKE '%".$sea."%' OR `nome` LIKE '%".$sea."%' AND `regione`='$re'
regione = '$re'
is the category.
I want to use WHERE titolo
LIKE '%".$sea."%' OR text
LIKE '%".$sea."%' OR nome
LIKE '%".$sea."%' AND regione
='$re'
It works well until AND. When i use one time OR and AND, it works, but when i uses several time OR and AND it doesn't works.
I tried MATCH and AGAINST but same error keeps coming up.