"Wa qala lilladhi zanna annahu najin minhuma udhkurni 'inda rabbika" (And he said to the one of them whom he knew would be saved, "Mention me to your master"), meaning: mention my affair to your master, i.e., the King. "Fa-ansahu ash-shaytanu dhikra rabbihi" (But Satan made him forget to mention it to his master), meaning: he made Joseph forget when he sought for the cupbearer to mention him to the King. That was after he had remained in prison for five years, supplicating to Allah and calling upon Him. "Falabitha fi as-sijni bid'a sinin" (So he remained in prison for a few years). Qatada said: He remained in prison after saying "Mention me to your master" for seven years as a punishment for his saying that.
Surah Yusuf from verse (43) to verse (49).