I don't think my iphone is charging?

I have bought an iphone, which came with a charger. But ever since I've got it, I've had problems trying to get the charger to connect with the phone. I don't know what to do about it, and when it does work, it says it's charging but it's not, any suggestions? The battery seems to always be between 20% and 50&.

Bring it back to the apple store & tell them about it they will probley give you a new one or they will try to fix it.