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 'AND 1=1) ORDER BY orden, nombre ASC LIMIT 0, 99' at line 1SELECT * FROM t_productos WHERE borrado=0 AND (codproductopadre IS NULL OR codproductopadre=0) AND visible='1' AND ( AND 1=1) ORDER BY orden, nombre ASC