How to sort by the smallest number my table with data that comes from an api

Asked

Viewed 28 times

0

How to sort by the smallest number my table with data that comes from an api?

<?php   
$query = $mysqladv->query("SELECT * FROM advogados_aux WHERE adv_idunico='$idadvun';");
        while($row = $query->fetch_array()){    

    $url = "https://maps.googleapis.com/maps/api/distancematrix/json?origins=".$row['adv_cep']."&destinations=".$c_cep."&language=pt&mode=car&key=AIzaSyDL6_dJ-Mbi_03_g6lHhWibxY22Z2UeYZQ";
    $json = file_get_contents($url);
    $json_data = json_decode($json, true);  


    $distancia = $json_data['rows'][0]['elements'][0]['distance']['value']; 
    ?>   
  • ORDER BY ASC or DESC variable at the end of the query does not work? Which variable do you want to sort?

  • I want to order by $distance

  • ORDER BY Distance ASC or DESC does not work?

  • that data is not coming from the database! ai do not know how to do!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.