function GetMun($GeoCod) { $Reg = array(); $Link = DBServerConnect(); if ($Link !== FALSE) { DBSelect(cDBName); $SQL = "SELECT * FROM Municipios WHERE Geocodigo = {$GeoCod} LIMIT 1;"; $ExeSQL = mysql_query($SQL); // or die (mysql_error());; $Total = MySQLResults($ExeSQL); if ($Total > 0) { $Reg = mysql_fetch_array($ExeSQL); } DBServerDisconnect($Link); } return $Reg; }
function MySQLResultsFromSQL($SQL) { $ExeSQL = mysql_query($SQL); return MySQLResults($ExeSQL); }
if (ValidarMunicipio($GeoCod)) { $Reg = GetMun($GeoCod); $NomeMun = $Reg['Nome']; $MapaURL = "http://www.projetorgm.com.br/map/#16/" . $Reg['Lat'] . "/" . $Reg['Lon']; $NotaURL = "http://www.openstreetmap.org/note/new#map=16/" . $Reg['Lat'] . "/" . $Reg['Lon']; $EditURL = "http://www.openstreetmap.org/edit#map=18/" . $Reg['Lat'] . "/" . $Reg['Lon']; } } else { $Municipios = ""; $Link = DBServerConnect(); if ($Link !== FALSE) { DBSelect(cDBName); $SQL = "SELECT DISTINCT Nome, Geocodigo FROM Municipios ORDER BY Nome;"; $ExeSQL = mysql_query($SQL); // or die (mysql_error());; $Total = MySQLResults($ExeSQL); if ($Total > 0) { $Municipios = "<form class='fancy inline' id='form-municipio' action='/municipios/' method='post' > <span class='icon next big'> </span> Meu lugar é: <select id='select-municipio' name='select-municipio' >"; $Municipios = $Municipios . "<option value='0' >escolha um município :)</option>"; for ($Cont = 0; $Cont < $Total; $Cont++) { $M = mysql_fetch_array($ExeSQL); $Municipios = $Municipios . "<option value='" . $M['Geocodigo'] . "' >" . $M['Nome'] . "</option>"; } $Municipios = $Municipios . "</select></form>"; } DBServerDisconnect($Link); } } ?> <!DOCTYPE html> <html>