How to identify solder
Plumbing solder is generally kind of thick - more than 1/8 inch.  Electronic solder is usually much thinner - less than 1/16 inch.

You can tell if solder has a core by melting some on a piece of paper - it will leave a greasy, maybe sticky spot if it has a core.

Thin solder that leaves a sticky spot when melted should be electronic solder.

As @EJP says, the problem is usually a break in the cable near the plug.  Cut the old plug off maybe an inch from the plug, strip the wires on both sides of the cut.  Use an ohmmeter to find out which wire goes to which part of the plug, and solder the wires on the other part of the cable (the part that goes to the headphone) the the correct places on the new plug.