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 t.id != 583 AND t.our_trip != 1 GROUP BY t.i' at line 9
SELECT t.* FROM site_tours t LEFT JOIN site_states_in_tour sit ON sit.tour_id = t.id LEFT JOIN site_states s ON s.id = sit.state_id LEFT JOIN site_types_in_tour tit ON tit.tour_id = t.id WHERE t.status = 1 AND ((t.date_till = '') OR (t.date_till IS NULL) OR (t.date_till > UNIX_TIMESTAMP())) AND s.id = AND t.id != 583 AND t.our_trip != 1 GROUP BY t.id ORDER BY t.date_add DESC LIMIT 4