Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
I had an old iPhone 4 with this problem and tried your solution, and it was a temporary one. It would work fine for a few days then act up again.
 
IPA, never had an Apple Store look at it so I'll never know if it was the cable, stubborn dirt, something broke with use. The phone was sold on CL many moons ago so I don't have it anymore.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.