I had the same problem and I fixed my iPhone 3GS.
I follow the comments here, got the link how to change the dock part. I went to the eBay and bought a new dock part (this is where the antenna is). I paid £5.99 in UK. I open the iPhone and changed it... it worked fine but stopped after a week. I open and disconnect and connect everything again, but didn't work, so I remember when I went to Apple the reset all networking so I did it and all working now.
I hope it help. Good luck