A generalized in situ electrodeposition of Zn doped CdS-based photoelectrochemical strategy for the detection of two metal ions on the same sensing platform.