Sounds like the board/port is either loose or not working as it should & needs replacing. You could always open the phone up & take a look/make sure it's in its right place. If after you've done that it's still causing problems, KeithRoss39 has a guide in the General section on replacing the board/port - it's quick/cheap (maybe US$15 or less)/easy to do yourself, his guide has all the info you need to get that done.
Edit - If that's happening with different cables, then it's obviously the port (either loose or needs replacing).
If it's important enough to cause you grief if it's lost, back it up. No excuses
Trolling for thanks is lame
Does Samsung's auto-brightness implementation crap drive you to self-harm ? A solution !
Failure to search is the leading cause of male impotence on XDA
If you don't know how to recover if things go wrong, what are you doing flashing custom roms ?