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 (p.ocultar = 0 OR p.ocultar IS NULL) AND p.borrado <> 1 AND tienda_familias' at line 9