Just insert it in your database, feed them two Google coordinates, and you get the distance in kilometres. If you happen to need it in miles, change the constant 12756.200 in the RETURN row to 7922.6 instead.
DELIMITER $$
CREATE FUNCTION `haversine` (lng1 FLOAT, lat1 FLOAT, lng2 FLOAT, lat2 …