Taping the cable is a temporary fix and does not make the cable last much longer, but it does give you some time.

Take the part of the cable that goes into the phone and slowly and carefully make a cut horizontally to separate the plastic. This needs to be done to expose the board. Once a cut has been made around the circumference, separate the two parts of the plastic coating to reveal the board inside and the wires connecting to it. Separate the two sections of wires. Once the board is exposed, there will be two different sections of wires going into the board. One section should be black and red; this is for the power supply. The other section can be various colors, but is most often green and white. Most likely, one or more of these wires have a loose connection with the board. Carefully separate the two sections of wires and straighten them out to identify their terminals. Use a soldering machine to reattach all the wires to the board. Once all the terminals are exposed, grab a soldering machine and very carefully, one by one, attach each wire back to the board. This is the hardest but most crucial step. This is a very small piece of board and hence harder to work with. Be careful with the soldering iron, as it can get very hot. Add glue around the wires to insulate it. You might want to add glow to insulate the wires you just attached so they do not touch with each other. Reattach the two plastic portions that were cut off. Using glue, reattach as precisely as you can the two portions of the plastic that was cut. It is very important to completely cover and insulate the board. Use more glue if needed to be safe but make sure if it completely attached and covered.