SELECT * FROM villes_france_free WHERE (ville_nom_soundex=SOUNDEX('Saint-Geniez-d'Olt') OR ville_nom_reel LIKE 'Saint-Geniez-d'Olt' OR ( ville_nom_alt !='' AND ville_nom_alt LIKE '%Saint-Geniez-d'Olt%' )) and ville_code_postal LIKE '%12130%' LIMIT 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '') OR ville_nom_reel LIKE 'Saint-Geniez-d'Olt' ' at line 2