you need to buy a new dock connector like this the ifixit part only shows the other side so you'd have to contact sales and ask if it has the home button contact before you buy from here. As you've already opened the phone I'm sure you've followed the excellent guides here but just in case..they are linked under the photo of the phone on the right..
For an iPhone 4 with that problem you could just replace it with a variation of this part which comes in white or black and a version for verizon or AT&T. You do not need to buy the charging port that comes with the loud speaker and 3G antenna, because yours is most likely perfectly fine.
Just buy the charging dock connect by itself.... It is a very easy repair.