Cobalt and copper pyridylmethylphosphonates with two- and three-dimensional structures and field-induced magnetic transitions.