4 prong dryer cord connected to a new 4 prong wall outlet, the old wall outlet was a 3 prong with only 3 wires. now the dryer won't heat but works
It's two separate problems, based on your description.  

One leg of "hot" not connected

Now I must admit, I leapt to the assumption that you replaced a large 3-prong NEMA 10 socket with a 4-prong NEMA 14, and that the previous socket was wired correctly (as correctly as a NEMA 10 can be). 

The "dryer spins, no heat" symptom indicates that neutral is connected (to something), the right one of the two hots is connected, but the other hot is not connected.  So I would carefully check the wiring connections at the socket.  Also if your are able, check that there is 120V between each hot and neutral.  

Now, there is one other place for this to go wrong, but it has nothing to do with installing a dryer.  Sometimes a very clever person replaces the wide 2-pole dryer breaker that takes 2 spaces, with a "double-stuff" breaker that takes one space.  That doesn't work, it will test out 120V on each hot lead, but they are the same pole, not opposing, so 0V between them instead of 240V. They need a quadplex.  

The missing ground

Moving to a NEMA 14 style connector is a leap forward for safety, because the old NEMA 10 came with officially approved instructions to bootleg ground from neutral.  The problem with bootlegging is, if anything went wrong with the neutral wire, It would definitely, positively, electrify the chassis of the dryer.  

As you have wired this, that won't happen.  However, if the dryer develops a certain type of ground fault, that can electrify the chassis of the dryer. Which is why we want to see a real ground there.   

Usually people say "oh, noes, that means running a new cable from the panel"... Actually, no.  You can retrofit just a ground wire.  And you don't need to go back to the service panel, any of these will suffice: 


a large appliance or junction box that has #10 AWG or larger ground wire going back to the panel
any junction box connected with non-flexible metal conduit back to the panel 
anywhere along the grounding electrode system, the bare metal wires going from your main panel to your ground pipes or rods