Actually for terestrial planets (like Earth and Mars); the planetary core needs to be molten and active, and the planet's rotation and metals in te core have a dynao effect that generates the field. Scientists theorize that Mars' core is either cold, or very minimally active; and that is why there is no planetwide magnetic field.
This brings up an interiesting question, since magnetic materials lose thair magnetism when heated above the courey (sp?) point, how can a molten core be responsible for magnetism?