Zinc(II) and cadmium(II) carboxyphosphonates with a 3D pillared-layered structure: synthesis, crystal structures, high thermal stabilities and luminescent properties