First, reset your phone, this is done by pressing the home and power button till the phone boots to the apple logo
From there, do what pollytintop said and replace the iPhone's data cable, or borrow one(iPods are standard across adults and teenagers, preteens, even kids, see if you can borrow a cable somewhere and if theirs works, replace yours)
If that is no help, as pollytintop said, check for damaged or dirty pins in the dock connector
Also, i would check the LSI(liquid damage sticker) in the dock connector, it may have been liquid damaged, it will be red if it was exposed t liquid, white if not
If none of this helps, the dock connector or logicboard needs to be replaced, and the soldering level is tough, so unless you think you can do it, find a shop who will do it cheap, just be prepared to buy the connector
just in case
note those are some of the tools you need and may need, but the pentelobe is only if your phone has pentelobe screws
Use to open your iPod, iPhone and other electronics — 50+ available at 2.95 each.
Compatible with the pentalobe fasteners on the iPhone 4 and newer. — 50+ available at 12.95 each.
Contains the connector and the microphone — 50+ available at 29.95 each.