Like tens of thousands of others, I found this thread after a perfectly functioning old iPhone suddenly would not charge. At first I admit I was tempted to Wonder what Apple might be playing at !
However, I got lucky I think - a friend offered a very old ipod cable to try and it worked immediately. That led me to go looking closely at the connector end of both cables to see if I could spot anything - sure enough the dud cable connector looked rather dirty - in fact there was some Black that looked suspiciously like soot from a burn out.
In my case we are talking an inherited 3 year old iPhone4 (I bought it new for my son who now has an iPhone 5) which has been dropped and suffered 2 front screens broken and one back, but which has nevertheless withstood careful amateur intervention/TLC and still remarkably plays ball :-)
Closer inspection under a magnifier showed me that actually that 30 pin connector only uses 6 live pins or should we say 6 live sprung sliding contacts.
Counting from the left with the connector logo downward and peering into the connector mouth, these pins are numbers 1, 15, 16, 23, 25, 27.
The connector on the iPod cable I was given was in very good condition and the 6 contacts are bright and copper coloured and easily visible under the magnifier. I'll have to be careful with my "new" cable however, because at both ends where the cable joins the connectors the rubber covering has parted exposing frayed coaxial underneath :-(
My dud cable seems to have maybe 2 or 3mm of contact number 23 burnt off.
That led me to wonder what caused it. So I looked using the magnifier with some trepidation into the phone port. There sure enough I found all the tinder material I needed to start another fire! More fluff than anyone ever finds in an unkempt navel! So with the phone off and gentle use of a toothpick, I teased out the fluff so hopefully it won't be happening again in a hurry!
I am hoping no serious damage has been done to the phone port by what was surely a short circuit of some kind (touching Wood I have not noticed anything weird with the operation of the phone), but I wouldn't mind suggesting that the build up of pocket fluff in the port with age is quite likely a principal cause of most of the problems that bring stumped owners to this thread.
Hope this helps, and commiserations to those whose problems are less easy to solve and prevent happening again.