The problem you are having is to do with the charging port of your phone. Dust or, more likely, moisture has entered. Here is the solution that worked for me:
Use a hairdryer to blow warm air into the charging port. It worked for me, hope it does for you.