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_categories IS NOT NULL and event_categories != 'nyny2017' ) or ' at line 6
Array object:
{
    "-query": "	SELECT count(*) cnt
	FROM events
	WHERE
		(
			1=1 and
			 and event_categories IS NOT NULL and event_categories != 'nyny2017'
		)
		or
		(

			event_recurring=1 and
			 and event_categories IS NOT NULL and event_categories != 'nyny2017'
		)"
}
SELECT count(*) cnt FROM events WHERE ( 1=1 and and event_categories IS NOT NULL and event_categories != 'nyny2017' ) or ( event_recurring=1 and and event_categories IS NOT NULL and event_categories != 'nyny2017' )