select * from where active=1 and (enddate='0000-00-00' or enddate>'2024-11-21') and (startdate='0000-00-00' or startdate<='2024-11-21') order by startdate desc
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 'where active=1 and (enddate='0000-00-00' or enddate>'2024-11-21') and (startdate' at line 1