You need to look at what was written?
"Yea, also the hearts of the sons of men are full of evil."
Get the context to see what state of mind cynical Solomon was suffering with.
Ecclesiastes 9:1-5
So I reflected on all this and concluded that the righteous and the wise and what they do are in God’s hands, but no one knows whether love or hate awaits them. 2 All share a common destiny—the righteous and the wicked, the good and the bad, the clean and the unclean, those who offer sacrifices and those who do not.
As it is with the good,
so with the sinful;
as it is with those who take oaths,
so with those who are afraid to take them.
3 This is the evil in everything that happens under the sun: The same destiny overtakes all. The hearts of people, moreover, are full of evil and there is madness in their hearts while they live, and afterward they join the dead. 4 Anyone who is among the living has hope—even a live dog is better off than a dead lion!
5
For the living know that they will die,
but the dead know nothing;
they have no further reward,
and even their name is forgotten.
Pretty dismal outllook?
Solomon was reaping living outside of doing God's will for his life.
It was recorded for others to know that they too can end up there as long as they do not return to following the Lord!
Verse 5 is proof and can not apply to the faithful believer!!!!!