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 '(zdpy='duotemengde' or kdpy='duotemengde') and to_days('2025-03-02 16:04:40')=to' at line 1 select * from ***_ecms_zb (zdpy='duotemengde' or kdpy='duotemengde') and to_days('2025-03-02 16:04:40')=to_days(livetime) order by unix_timestamp(livetime)