David said because of the things he loved he had enemies. We know that David loved God, gospel music, his family and his friends. These are good things, but there are some that don't like God, and because we do, they will be our enemies. We know that if we love God, we at least have one enemy, and that is Satan. And just like he did to Job, Satan will assault us with anything he can to discourage us. You see he wants your love for God to wax cold, he wants you to be defeated. The Psalmist gave us the answer for when the enemy attacks, he said he gave himself to prayer. You see the good thing about problems is they drive you to pray. I recently talked to a pastor and he shared that he was facing some difficulties, things like church members who had teenagers that had ran away or attempted suicide, he said, "on the good side, it makes me give myself unto prayer." He said because of these things he gained a closer relationship with God.
Have you ever met someone or had something good come as a result of a problem? I was in a hole installing a sewer onetime and a 40lbs rock fell and hit me on the leg, as a result they quickly lifted me out of the hole, and right after i got out, the whole wall caved in. I would much rather take a bruised leg over being buried alive. Likewise at the first sign of danger we need to run to the one that can lift us above our anxiety and give us the wisdom not to make greater mistakes.
May God bless you