You are probably talking about an electro magnet. For detailed explanations and some good drawings see the link on electromagnets here:
core
No, the core has to be a soft iron core.
an electromagnet
Core
Its an electro-magnet - currents flowing through the iron core.
the molten iron core
the molten iron core
Rotating iron core.
the molten iron core
a magnet
a magnet
This is a really simple answer, as I am only 10, but the Earth itself is a big magnet, as it has a a core of molten iron. The iron in the core, acts as a magnet and therefore, exerts its own magnetic field. Sorry it is so simple!