My iphone 3g won't charge or sync to computer?

My iphone 3g won't charge or sync to computer? Can anyone help me?
it charges when its off? Because when its off and connected to the usb and after i turn it on, its fully charged? But when i plug it in when its on to the computer or even without the computer it doesn't connect or charge?

Make sure you're using the version of iTunes that works for your phone. They contain drivers that make your iPhone 3G work with your computer.iTunes 10 should work.