WP_Query posts by distance based on LAT & LNG in Database

You want to use the Haversine formula

http://en.wikipedia.org/wiki/Haversine_formula

This plugin might be of interest to you:

http://wordpress.org/extend/plugins/wp-geoposts/

Provides WP_GeoQuery an extended WP_Query class for doing distance based and geo-aware queries.

it uses the Haversine formula here:

http://plugins.svn.wordpress.org/wp-geoposts/trunk/query.php