I am making my first ever PHP app and I am flummoxed at the final hurdle.
I am looping my results and need to sort the results of a function inside a foreach loop in PHP.
If anyone has any insight into how I can do this it is much appreciated!
foreach($data as $d) {
echo $d["StudioName"]; // This will output "This is a test!"
echo distance($lat, $lng, $d['StudioLat'], $d['StudioLong']);}
Basically I need is to be sorted by the "distance" function results.
$sqlSelect = "SELECT * FROM studios WHERE StudioLat BETWEEN $minlat AND $maxlat AND StudioLong BETWEEN $minlng AND $maxlng"; // Basic SQL SELECT Statment
$data = $dataBase->getQuery($sqlSelect); // This will run the SQL statment and return and associative array.