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 'AND r.iata != '' GROUP BY r.iata ORDER BY RAND()' at line 5
SELECT r.*, r.name_eng as name FROM regions r WHERE r.state_id = AND r.iata != '' GROUP BY r.iata ORDER BY RAND()