Gravity is a force of attraction between objects. Larger objects like planets have a bigger force of gravity than a smaller object would. However, gravity is what holds the planets in orbit around the sun and in position relative to the sun and to eachother. Gravity is a force exerted by Earth's center, but it is not exerted equally everywhere on earth. Because Earth is an oblate spheroid and not a perfect sphere, the pull of gravity is dependent on where you are on Earth. Those at the Equator experience a weaker force of gravity than those at the Poles(where the distance to the center of the Earth is shorter). Therefore, since the weight of a mass is dependent on the force of gravity on that mass, you would weigh slightly less at the Equator and slightly more at the Poles.
It is incorrect to say that there is no gravity in space. I believe that you are confusing this with being weightless in space. The planets are bound to the sun by gravity as we are bound to the Earth by gravity. Astronauts are constantly "falling" as they orbit the Earth, the weightlessness is due to their speed relative to the surface of the Earth. Far enough away from a planetary surface (or any other massive object) and you would be "weightless" because you would feel very little gravity. However, wherever you went in space you would have some attraction to every other object in space. It is possible that the net effect could be exactly zero force, but more likely the force acting on you would be neglible, not zero.
It is because of Newton's first law. '' Gravity ''