Do you have access to another USB dock connector cable to rule out a problem with the cable you are using?
If there is a hardware failure and it sounds like there is, you have several options.
If a problem with the battery only, Apple will replace the battery only.
http://www.apple.com/support/iphone/service/battery/
If a problem with the battery only, there are also some 3rd party repair services that will replace the battery only.
If a hardware problem other than the battery, Apple offers an out of warranty or not covered under the warranty "repair" price, which pays for an exchange at a discounted price off of what was the full retail sales price for the original iPhone. The cost is $199 plus tax and this price does not require signing a new contract with AT&T.
If a hardware problem other than the battery, there are some 3rd party repair service that should be able to replace whatever needs to be replaced for less than $199, but probably for not much less depending on what needs to be replaced. Apple's price pays for an exchange.
Or for $199 you can purchase a 3GS and for less, purchase a 3G, or wait to see what Apple announces on June 7th to being their annual World Wide Developers Conference, but this will require signing a new contract with AT&T.