You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) AND( ((DisplayOn LIKE 'D,%') OR (DisplayOn LIKE '%,D') OR (DisplayOn ...' at line 4. SQL query:
SELECT *
					FROM gs_product_option
					WHERE ('P'='' OR Status='P')
					AND (CategoryID=0 OR CategoryID IN (58,))
					AND( ((DisplayOn LIKE 'D,%') OR (DisplayOn LIKE '%,D') OR (DisplayOn LIKE '%,D,%') OR (DisplayOn = 'D')))
					AND  (0=0 OR ProductOptionID!=0)
					
					
					ORDER BY Ordering ASC