i have had this problem before but i fixed it.
what you have to do is open it up, and the little coloured wires that connect the battey to the phone,unplug those wires from the phone and reconnect them, this worked for me.
or maybe your charging cord is broken or the charging port on your phone...