Iphone stuck on Charging not supported screen?

I have an iPhone 3GS, I've had it for two years, always took good care of it, Two days ago I took my phone off the wall charger (the original one it came with) and instead of going to my lockscreen a message came up reading "charging is not supported with this accessory" even though it was not plugged in to anything. Restoring the phone does nothing. I just now tried cleaning out the place you plug in the cord and after locking it and unlocking it about three times there was one time where I actually saw my lockscreen but now its back to the error message.
Any clue what could be wrong and how I could fix it?

Problems like that usually occur from a faulty cord. Cords where out over time and have to be replaced.
Another reason which is fairly rare is that the phone has taken some water damage. I highly doubt it is that though from the way its been taken care of. I would say just try a new cord and see if that helps.

Seems like others had the same issue: http://www.gatorspit.com/tips/iphone-wont-charge.html