I Have a table named FRANCE like this
City Region LAT LNG
PARIS L'Ile-de-France
MARSEILLE Provenza
Now, LAT and LNG values I retrieve throught a function that use google api. To do this I must concatenate City and Region
So this is what I do:
$sql="Select * from France";
$result=mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($result)){
$city=$row['city'];
$region=$row['region'];
$address=$city.",".$region.", France";
$coordinates = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&sensor=true');
$coordinates = json_decode($coordinates);
$lat = $coordinates->results[0]->geometry->location->lat;
$lng = $coordinates->results[0]->geometry->location->lng;
}
Now I'd like to update the table FRANCE to have this output
City Region LAT LNG
PARIS L'Ile-de-France 48.856614 2.352222
MARSEILLE Provenza 43.296482 5.369780
How can I do?