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 event_start IS NULL AND event_end IS NULL AND ((( start_date is NULL ' at line 3 Query: SELECT * FROM articles WHERE live = 1 AND category_id = AND event_start IS NULL AND event_end IS NULL AND ((( start_date is NULL OR start_date <= NOW() ) AND ( end_date is NULL OR end_date >= NOW() ))) ORDER BY `start_date` DESC, `created` DESC