The first thing to do when your iPhone won’t charge is to check to make sure that there is no lint or other debris jammed into the connector or your USB cable. If you find this is the case, you can use canned air to clean the connector or cable and then try again.

If your iPhone still isn’t charging, make sure it is connected directly into a USB port in your computer instead or your keyboard or any other type of USB dock. Better yet, plug it into a wall outlet just in case your USB port isn’t working correctly. If your iPhone won’t charge through the wall outlet, check the cable to make sure that it is working, if it isn’t, you may need to buy a new one. These can be picked up fairly inexpensively at places such as Best Buy.

If none of these ideas have worked, then it could be that you need a new battery. If your iPhone is less than a year old, this should be free as a part of your warranty, or if you have AppleCare it will be free for your phone no matter how old it is. Otherwise you will have to buy one and have it serviced in order to have the new battery installed.

Resource: About IPod