What I am trying to do is I have entries in the database which have a lat/long stored with them. I want to calculate the distance between users lat/long and entries lat/long
i would not recommend dumping distance calculations in your sql statement, even though i admit that the solution presented by 'denil' is ingenious.
there are 3 downsides: code maintenance, sql server overload AND (above all) the earth is not symmetrical (it is like an old dented baseball that was run over by a truck). this means that you might want to change the code in the future (there are some VERY sophisticated algorithms out there - http://en.wikipedia.org/wiki/Geographical_distance).
i recommend using a separate function that calculates distance with a simple common algorithm (similar if not identical to denil's). i submit this code which is pure php (no need to use googlemaps api):
there are a number of free softwares (try gps trackmaker) that will allow you to check the margin of error for your part of the globe (if you need precision). for the above lat/long pair, the error is within +/- 0.1% (according to local topographers).
ATTENTION: this formula gives you CARTOGRAPHIC distance (distance at sea level), not TOPOGRAPHIC distance (disconsiders topography).