As stated in the The Internal Pressures of the Planets, if we use the surface gravity of a planet as an approximation to its internal gravity we can show that the internal pressure is proportional to the square of the surface gravity. But as described there, the internal gravity varies from place to place, dropping to zero at the center. So how can we be sure that the original approximation is in any way near the correct value?
Let's take a more accurate look at how the calculations would be done if we were willing to use the appropriate kind of mathematics, namely integral calculus, to do them. (Please note that you do not need to be familiar with calculus to follow this discussion, nor are you expected to be able to reproduce this on your own. This is just to show how things are more or less accurately done, and how the results compare to the simpler approximations used in the other discussion.)
Let's imagine dividing a planet into a nearly infinite number of very thin layers, each with a thickness dr (equal to the radius of the planet divided by that nearly infinite number of layers) which is so thin that its thickness is negligible in comparison to the size of the planet, and the density of the material within that thin layer can be thought of as being essentially constant. (Note: In calculus, writing a quantity as "dsomething" specifically means that we are using only a very thin layer of whatever "something" stands for.)
At the top of the layer the weight per unit of area that is compressing the material and the equal pressure opposing that weight would be given by w_{r} and p_{r}, the subscript r indicating that those are the values at the particular distance from the center of the planet, r. At the bottom of the layer, however, the two (equal) values must be slightly greater, because there is some extra weight within the layer, dw, which would be equal to the density of the material in the layer, d_{r}, multiplied by the volume of the layer, which is dr times the area of the layer. Since we are defining everything in terms of the weight or pressure per unit of area, the area of the layer can be taken as one unit, and we can ignore that. As a result the extra weight dw would be equal to d_{r} times the local value of the planet's internal gravity, g_{r}, times the thickness of the layer, dr. Note that the letter d is used here in two ways  as the density, and as an indicator that we are using a small amount of some unit. For that reason the letter used to denote density is usually not d, but the Greek letter rho (ρ). We therefore write
dw = dp = ρ_{r} g_{r} dr,
where we have indicated that the increase in p_{r}, which is called dp, is of course equal to the increase in w_{r}.
With these definitions and statements in mind, we can now calculate the pressure and weight at various depths inside a planet simply by adding up all the values of dw and dp, starting at the surface of the planet and going downward to its center. This could be expressed as
w_{r} = p_{r} = w_{surface} (= 0) + dw_{first layer down} + dw_{second layer down} + and on and on and on,
adding up however many layers we need to reach radius r. Obviously, if the number of layers is very large (and since we are specifiying that they are very thin layers, going down any substantial distance would require a very large number of layers) this would get very messy, so we indicate the sum of all the terms involved by a special symbol, the integration symbol, , which means "add up all the individual values starting at the surface R, going down to radius r", and write the above equation as
w_{r} = p_{r} = dw = ρ_{r} g_{r} dr.
Of course, writing this formula in a simpler way doesn't mean it is all that easy to actually do the arithmetic, as we have to know what the values of ρ_{r} and g_{r} are at every point inside the planet, and that is not something we can know with certainty. But to give an idea of how things work, let's suppose that the density ρ_{r} happens to be the same everywhere (in other words, assume we are dealing with a "uniform" planet), so it is equal to the mass of the planet divided by its volume
ρ_{uniform planet} = M / (4/3 π R^{3}) = 3 M / 4 π R^{3}.
Under those circumstances the gravity at a given place would be directly proportional to the gravity at the surface of the planet, or
g_{r} = g_{R} r / R,
so ρ_{r} g_{r} dr
would become (3 M / 4 π R^{3}) (g_{R} r / R) dr.
But g_{R} is equal to G M / R^{2}, so this becomes
(3 M / 4 π R^{3}) (r G M / R^{3}) dr,
or, rearranging like terms,
w_{r} = p_{r} = (3 G / 4 π) (M / R^{3})^{2} r dr = (3 G / 4 π) (M/ R^{3})^{2} r dr,
where the constant terms have been removed from the integral sign because they don't affect the integration.
Up to this point, although the mathematics appears difficult all we have been doing is defining things and rearranging them, and no actual arithmetic has been done. But if we want to get a specific result we have to do the integration, so if you are unfamiliar with integration you will just have to take my word for it that the term inside the integral sign becomes
1/2 (R^{2}  r^{2}) = 1/2 R^{2} (1  (r/R)^{2}).
Inserting this in the previous equation in place of the integration yields
w_{r} = p_{r} = (3 G / 4 π) (M / R^{3})^{2} 1/2 R^{2} (1  (r/R)^{2}),
or, rearranging and combining terms,
w_{r} = p_{r} = (3 G / 8 π) (M / R^{2})^{2} (1  (r/R)^{2}),
or since the surface gravity, g_{R}, is equal to G M / R^{2},
w_{r} = p_{r} = (3 / 8 π G) g_{R}^{2} (1  (r/R)^{2}).
In other words, at least in the case of planets with uniform density, the pressure at various points inside the planets is directly proportional to the square of the surface gravity, exactly the same result we obtained when presuming that the gravity inside was everywhere the same as at the surface. This does not, of course, mean that things work out so nicely when the density changes from place to place, and the way in which the pressure changes as you go into the planet would not be the same if calculated using the incorrect assumption of a uniform gravity as it is when calculated correctly, but it does show that if we want to compare the pressures inside various planets, squaring their surface gravities isn't a bad first approximation.
Finally, having calculated the actual value for pressure at various points inside a uniform planet, we can calculate how the pressure changes from place to place, as shown in the diagram below. Near the surface, where the gravity is close to the surface gravity, pressure increases more or less uniformly, but as you near the center of the planet, where the gravity approaches zero, the pressure levels off and becomes nearly constant in the central parts of the planet.
The pressure inside a uniform planet. The numbers along the bottom show the fractional distance from the center of the planet, r/R.
Pressure, increasing upward, has a maximum value of (3 / 8 π G) g_{R}^{2}.
