My iphone 3g will turn on when plugged in but will not charge?

My charger works on my other apple device and will connect to itunes but with my iphone 3g, it just turns on and then stays on for a little bit until it dies again. It won't charge at all. Help

Added (1). I already restored everything but now it wants me to connect to itunes and i can't because it won't charge. And when you plug it into your computer, its supposed to charge.

Restore your phone or turn off your apps

Bad battery. They only can be charges a limited number of times. The battery lasting 3-5 years is exceptional, most last 2 years before needing replacement.