Not sure PHP here is the right place to do the math. Especially if there is a lot of records to filter in that table.
You might want to look at http://www.dereuromark.de/2012/06/12/geocoding-with-cakephp/
You seem to be working with distances. In that article the whole calculation is done in the SQL directly - using virtual fields and a clean approach via behavior. Try to get this working. It will make it not only easy for you to work with distances or lat/lng fields, it will also keep it DRY.
Sorting and filtering is all included.