require 'dbconn.php'; //prendo id selezione comune da form $nomecom= @$_GET['comune']; //query tabella comuni $query2="SELECT * FROM comuni WHERE localita='$nomecom'"; $risultato2=mysql_query($query2); $row2 = mysql_fetch_array($risultato2); $localita= $row2['localita']; $altitudine=$row2['altitudine']; $latitudine= round($row2['lat'],2); $longitudine= round($row2['lon'],2); $latint = floor($row2['lat']); $lonint = floor($row2['lon']); $difflat = $latitudine - $latint; $difflon = $longitudine - $lonint; $restolat = 1-$difflat; $restolon = 1-$difflon; if ($difflat<=0.25) { $lat = $latint; $lat1 = $latint+0.25; } elseif ($difflat>0.25 && $difflat<=0.5) { $lat= $latint+0.25; $lat1 = $latint+0.5; } elseif ($difflat>0.5 && $difflat<=0.75) { $lat= $latint+0.5; $lat1 = $latint+0.75; } elseif ($difflat>0.75) { $lat= $latint+0.75; $lat1 = $latint+1; } if($difflon<=0.25) { $lon = $lonint; $lon1 = $lonint+0.25; } elseif ($difflon>0.25 && $difflon<=0.5) { $lon = $lonint+0.25; $lon1 = $lonint+0.5; } elseif ($difflon>0.5 && $difflon<=0.75) { $lon = $lonint+0.5; $lon1 = $lonint+0.75; } elseif ($difflon>0.75) { $lon = $lonint+0.75; $lon1 = $lonint+1; } ?>