"So I turned my mind to understand, to investigate and to search out wisdom and the scheme of things and to understand the stupidity of wickedness and the madness of folly." NIV translation
Solomon understood that wisdom came from God and did not understand why someone would look to the ways of the world for guidance. He described it as stupidity and we can agree that walking down the middle of the road is not very smart. If you do so, then, you can expect to be hit by traffic and that is crazy.
"I find more bitter than death the woman who is a snare, whose heart is a trap and whose hands are chains. The man who pleases God will escape her, but the sinner she will ensnare." NIV translation
Now, Solomon speaks of his personal failure as he describes the dangers of falling for a woman that God has not made for you. We must remember that God had told Solomon that the kingdom would be divided after he died because of the fact that he had married a woman that God had said to avoid. He fell for her outward beauty and disregarded the wisdom of God.
"'Look,' says the Teacher, 'this is what I have discovered: Adding one thing to another to discover the scheme of things - while I was still searching but not finding - I found one upright man among a thousand, but not one upright woman among them all. This only have I found: God made mankind upright, but men have gone in search of many schemes.'" NIV translation
Solomon's conclusion is that God made man in His image but man chooses to stray and follow the ways of the world. It is easier to go along and get along than to stand out. It seems that this is even more true these days.