Soldering Pipes
    First , the pipes must have the burrs removed from the inside of the cut ends or the water turbulence can actually wear the pipe through in a very short time !  Do NOT think you can get away without doing this ,  EVER !  If you can find it there is this little yellow and black tool that will do this with ease , otherwise most pipe cutters will have a poor tool attached to them that will do it for you with some frustration and minor cuts .

The main reasons a pipe fitting won't solder for you or leaks is ;

1: The pipe is poorly cleaned .
     All of the joint surfaces must be cleaned of oxidation and any coating or gum from store labels or the solder will not flow and the joint will leak !  If possible all parts should be pre cleaned and de-burred before dry fitting in the wall then all parts fluxed and reassembled just before soldering checking for any missed dull spots .
    All areas to be soldered  ( plus a little more on the pipe to ease the process ) must be cleaned with fine sand paper ,  the best type found in the stores plumbing section as a roll of tape .  Hold the paper and twist the pipe ,  or hold the two ends and pull them back and forth while the center is looped over the end of a pipe held in place ,  pay particular attention to the side you can't see .
clean the inside of the fittings watching for scratches and creases from the casting process .  Any lines left un-cleaned will cause a leak .
you can also buy wire bushes for each size fitting you use ( or combination brushes ) , which if you are doing more than about two fittings it is worth the price to save time ,  as well as the pain of the hang nail from sticking your pinkie in the fitting to sand it .
Coat all cleaned areas with a thin coating of flux ,  just enough to cover but no globs .  The solder will only flow where the flux has coated so if the fitting has threads use as little flux as needed to coat the soldered area of the fitting .

2: There is water in the pipes .
    Water that boils from the torch becomes steam which will either blow your joint apart ,  or contaminate your newly cleaned parts or blow the solder out of the fitting ,  possibly in your direction . In any case you won't get it soldered so ;
    After turning the water heater to pilot ,  ( or the electric one off  ) ,  and shutting off the water ,  open all the faucets including the up stairs faucets to let air into the pipes and let the water drain out of the lowers place possible which may be the basement water heater drain .  It may seem a lot of trouble to go to , but I have spent hours trying to get a joint soldered while the upstairs pipes slowly dripped on my joint ruining my parts .  If you have to boil standing water out of a pipe or dry it with a torch  , leave the joint open while you do so and be careful not to scorch the pipe .  Don't burn yourself putting things back together .

3: Or bad heating of the copper .
    You can over heat the pipe and scorch it which often happens if you don't follow the instructions above , or if you are trying to heat the pipe with too small a torch , or if you are not moving the torch to spread the heat beyond a single point .
start by heating the fitting .  You will notice at first the steam from the torch ( propane burns to CO2 and H2O +) will condense on the fitting causing it to dull , as it heats this will stop and you should start to move the torch back and forth and to the back side .  As the flux melts and starts to run , move the torch to the pipe moving around it with the torch slightly angled towards the fitting . watch the flux when it starts to bubble you're very close and you had better have pulled out the solder and have it ready by now ( bend the end into a slight candy cane ) .  Don't hold it under the torch , but touch it to the cleaned area on the pipe right up against the fitting on the other side and if the pipe is hot enough ( just as the flux boils away ) the solder will be sucked into the joint and towards the heat on the other side . once it flows move the torch to the fitting for just a moment as you move to the pipe on the other side and apply the solder to there and remove the heat .  Once the solder flows you don't need to continue heating the joint ,  in fact it will make it more difficult to fill the joint if it is over heated and scorched .  Check that the solder has flowed completely around the pipe and wipe the excess around the joint with a cloth to close any possible pin holes and let the joint set till the solder dulls .

Give the pipe ten minutes to cool before turning the water back on slowly ( remember to turn off all but one faucet before flooding the house ) then when the air has cleared the pipe to the kitchen faucet turn it off and bleed the air from the other faucets in the house . Then let the closest faucet to the new joint run for a bit to wash out the flux .