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; }
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> <head> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <meta charset=utf-8 /> <meta name="description" content="Mapa do lugar onde você vive - compartilhe, ajude a melhorar!"> <title>Municípios no mapa - SP</title> <link rel='shortcut icon' href='mv.ico' type='image/x-icon' /> <link rel="shortcut icon" href="favicon.png" type="image/png"/> <link href='https://www.mapbox.com/base/latest/base.css' rel='stylesheet' /> <style> body { margin:0; padding:0; }