Put distance calculating SQL query into a function.
Removed mysql passwords from index.php. oops