Not sure if anyone who posted originally in this thread is still interested or not.
But I have/had an iPhone with this problem. It would turn on ONLY when connected to a power supply, the Apple logo would appear for a little while, then the phone would turn off in a rather unglamorous fashion. The best way I can describe the way it turns off is... Did anyone own one of the original yellow & black lcd gameboy's? The big white brick things? Well when the phone died it was like turning off one of those, you'd get the apple logo freeze and a couple of lines come across the screen for a couple of seconds, then total shutdown.
I tried doing a DFU restore on it, receiving the error 23 message near the start of the update...
Error 23 refers to an Hardware issue (can't be arsed to find the link, but it's documented on Apple's site), more to the point, error 23 usually refers to a connectivity error.
So, I fiddled with battery screws as advised here, no joy. I proceeded to replace the battery as it could've been a dud (bought the phone 2nd hand as faulty, so had no idea on its history. Also the sticker was removed from the MB). No joy, same results.
So, going back to my point about error 23 being a connectivity error, I assumed that the USB port must of been faulty, only allowing through a very small amount of electricity as to barely charge the battery. Then, once it's turned on, it uses all it's power and dies. Picked one up on ebay for £5, stuck it in, and bingo.
Works like a charm now. So if you're reading this, and your phone doesn't appear to be accepting charge, and iTunes can pick it up in DFU, but can't restore because of error 23, this is probably your solution.
Hope this helps someone.
Peace!