Thank for contacting Fixya, I will be glad to assist you.
What you can do, in order to resolve this issue, is start by resetting your iPhone 3G.
(Note: this does not remove any settings, data or media you have installed in your device)
• To perform a hard reset, press and hold your Sleep and Home Menu buttons for approximately 10 seconds.
• Once your screen goes black, release both keys. (If you see a white Apple logo before you release the keys you have held the keys to long and will need to start the reset process once again)
• The next screens you should see after the black screen, is the Apple logo screen followed by the main screen.
• This hard reset process should help bring your iPhone 3G back to normal functionality.
It would also be advisable to connect your iPhone 3G via its docking cable and provided wall socket adapter into a working wall socket in order to try and charge it.
If your iPhone 3G still does not charge, try connecting it with the docking cable to your computer or laptop to observe if it will take a charge then.
Should this process also not affect the way the iPhone charges, then you should look into using or purchasing another iPhone docking cable, as the cable itself may not be functional and needs to be replaced.
Docking cables for iPhones are fairly inexpensive (Under $20) and can be found in most electronics/computer stores that carry Apple products and accessories.
(Link: Apple Dock Connector
Finally, if a replacement docking cable does not help the iPhone 3G charge, this may be a hardware issue and you would be advised to take the iPhone 3G in to your local Apple retail store or Apple Authorized Service Provider in your area.