Why do the same planets have rings and others don't?

Because some planets are solid and others with rings are just huge balls of gas sometimes called gas giants