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 ')='10' AND LOWER(l.nume_loc)='caransebes' LIMIT 1' at line 3SELECT l.nume_loc AS loc, l.nume_tara AS tara FROM besttour_new.c_loc_cache l WHERE l.id_tara)='10' AND LOWER(l.nume_loc)='caransebes' LIMIT 1