As RN said it could be the cable OR the port. IF this has happened to you on multiple phones you MIGHT want to take a look at how you are plugging and unplugging the cord. Make sure you hold the cord from the end when you plug it in or pull it out. Also don't force it, it only goes in 1 right way (unless it's USB-C), and forcing it in the wrong way will break the socket. Pulling from the cord constantly can cause problems also, such as a loose broken wire in the cord, OR a broken socket. Try to avoid messing with the cord when you are half asleep. Plug it in right BEFORE you go to bed, unplug AFTER you get up and shake off the cobwebs!