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 'ORDER BY KEYWORD OR CLASSNUM = 530 AND '1997'<=BEGYEAR AND '2017'>=BEGYEAR AND D' at line 1