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 ban_ends > "2008-08-21" AND ban_starts <= "2008-08-21" ORDER BY aorder ASC' at line 1