select * from where active=1 and (enddate='0000-00-00' or enddate>'2019-08-24') and (startdate='0000-00-00' or startdate<='2019-08-24') 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>'2019-08-24') and (startdate' at line 1