= 1) { return 0; } else { $insert = "INSERT INTO $tabela (uf,mun_ddd,mun_nome) VALUES ('$uf','$ddd','$nome')"; $query = pg_query($dbcon, $insert); $sql = "SELECT mun_id FROM $tabela WHERE uf='$uf' AND mun_ddd='$ddd' AND mun_nome='$nome'"; $query = pg_query($dbcon, $sql); if (pg_num_rows($query) >= 1) { return 1; } else { return 0; } } } //verifica tratamento dos valores if (TrataValor($uf, $ddd, $nome) == 1) { $tabela = "pbx_municipio_classifica"; $inseri = ExecBanco($dbcon, $tabela, $uf, $ddd, $nome, $id); //retorna verdadeiro se registro for inserido if ($inseri == 1) { $mes = "Registro inserido com sucesso!"; } else { $mes = "O registro já existe na base de dados!"; } } // if (!is_numeric(TrataValor($uf, $ddd, $nome))) { $mes .= TrataValor($uf, $ddd, $nome); } if ($_GET['acao'] == "inEX") { $nome = $_GET['municipio']; $uf = $_GET['uf']; } //IMPRIMI COMBO UF---- $sqlUF = "SELECT uf FROM pbx_uf ORDER BY 1"; $resultUF = pg_query($dbcon, $sqlUF); while ($rowUF = pg_fetch_array($resultUF)) { $uf_select = $rowUF["uf"]; $optionUF .= ""; } $smarty->assign('mes', $mes); $smarty->assign('optionUF', $optionUF); $smarty->assign('ddd', $ddd); $smarty->assign('nome', $nome); $smarty->display("cadastros/municipio/municipioInsert.html"); ?>