The shell of the Earth is solid. The middle is a liquid. The core is a solid. Why?
While we’re waiting for a geologist to happen by, you might take a look at this section of the Wikipedia article on Earth’s interior. Executive summary: lots of pressure at the bottom makes it solid; less pressure in the middle allows it to be liquid; and a different composition near the top means that it’s solid again.