King Solomon wrote the book of Proverbs for his son.  In chapters 5, 6 & 7 he warns his son about the trap of adultery.