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 ( c.type_id = 2 or c.type_id = 3 or c.type_id = 4 or c.type_id = 8 or...' at line 6