If the USB end isn’t fitting into the PS3’s port, rotate the USB end 180 degrees and try it again. The piece of plastic inside of the USB cable needs to fit below the piece of plastic at the top of the USB slot on your PS3.
Leave your controller on the charger cable for at least an hour before disconnecting it.
Third-party USB cables often don’t work with PlayStation technology, so if you buy a new cable, make sure it’s from Sony.