Walk with wise men and you will become wise, but the companion of fools will fare badly. (Proverbs 13:20). Now compare that with Proverbs 14:7 -- Leave the presence of a fool, or you will not discern words of knowledge.
Solomon was referring to establishing friendships with people. Or, as St. Paul said centuries later, "Bad company corrupts good morals" (1 Corinthians 15:33).
But I think argument can also be made from these two proverbs to avoid companionship with godless or immoral ideas. If we spend time garnering worldly attitudes popularized through television, the internet and other media, we will have less desire for God's wisdom. We will be less able to discern "words of knowledge" if we are companions of ideas which God calls folly. Again, as St. Paul wrote, "Do not be deceived, God is not mocked; for whatever a man sows, this he will also reap. For the one who sows to his own flesh will from the flesh reap corruption, but the one who sows to the Spirit will from the Spirit reap eternal life." (Galatians 6:7-8)