ele já funciona, quero dar um up nele...
Fala pessoal, como jah falei anteriormente meu conhecimento em PHP e MySQL restringe-se ao uso avançado do Dreamweaver, com ele faço meus sistemas para a net, mas acabo esbarrando nos sistemas de busca, claro que com o Dw podemos fazer algo bem simples, mas não o que procuro, gostaria muito da ajuda dos amigos do fórum...
oK, tenho um sistema de busca que procura dados em uma tabela de um banco MySQL e me traz os resultados:
Esse é o local onde se faz busca:
/applications/core/interface/imageproxy/imageproxy.php?img=http://www.lanhi.com.br/andrey/0.jpg&key=09093c879eae764ec48feaac0c362dc27349d0ca389e2bbbf559360f59eb79af" alt="Imagem Postada" />
Quando alguém faz a busca, vai selecionar o estado e a cidade, (campos respectivos no BD), esqueçam os campos "nome da empresa" e "Produtos e Serviços", ele procura na tabela Clientes:
/applications/core/interface/imageproxy/imageproxy.php?img=http://www.lanhi.com.br/andrey/1.jpg&key=3736881d7fd0a608cc80af99f3320bf30ff1fb52df5ef096cdb5625270709fe0" alt="Imagem Postada" />
Nos campos "ResumoServicos" e "Servicos" e me mostra os resultados da seguinte forma:
/applications/core/interface/imageproxy/imageproxy.php?img=http://www.lanhi.com.br/andrey/2.jpg&key=b1c568bf9c4beecdd044e5baca295d47a0f2f8f7f1191761710d05890a49e86f" alt="Imagem Postada" />
Até agora tudo funciona perfeitamente, mas gostaria de arrumar uma coisa, na imagem acima das tabelas eu mostrei duas e ele agora tá fazendo busca em apenas uma, gostaria que a busca fosse feita nas duas tabelas...
Quando alguém faz a busca ele vai buscar nos campos da tabela "CLIENTES" e procurar nos campos "RESUMOSERVICOS" e "SERVICOS" e vai mostrar ordenado por "NOMEFANTASIA" em ordem alfabética, logo depois vai buscar na tabela "CLIENTESGRATUITOS" nos campos "NOMEFANTASIA" e "SERVICOS" e me traga os dados ordenados por "NOMEFANTASIA" em ordem alfabética....
É importante que os Clientes Gratuitos apareçam depois dos Clientes....
Imagino que deva ser difícil, mas não custa nada tentar, sempre consegui muita ajuda aqui no fórum, muito, muito obrigado...
Os Códigos:
Formulário de Busca:
<form action="busca_resposta.php" method="post" name="pesquisa" id="pesquisa">
<table width="92%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td colspan="4" class="menu_pequeno">Palavra Chave</td>
</tr>
<tr>
<td colspan="4">
<input name="text" type="text" class="formularios" id="text" size="50"></td>
</tr>
<tr>
<td width="8%"><input name="radio" type="radio" id="radio" value="empresa" checked></td>
<td width="35%" class="txt_normal">Nome da Empresa</td>
<td width="11%"><input type="radio" name="radio" id="radio2" value="produtos"></td>
<td width="46%" class="txt_normal">Produtos e Serviços</td>
</tr>
<tr>
<td colspan="2" class="txt_normal">Estado:</td>
<td colspan="2" class="txt_normal">Cidade:</td>
</tr>
<tr>
<td colspan="2"><select name="uf" class="formularios" id="uf" onChange="doBusca(this.options[this.selectedIndex].value)" >
<?
$cont=0;
do {
$estado=strtoupper($row_rsExibeCidade['estado']);
$pos = strpos($str,$estado);
if ( $cont == 0 or $pos == 0 ){
?>
<option value="<? print $estado ?>"><? print $estado ?></option>
<?
$str="$str $estado";
$cont=$cont+1;
}
} while ($row_rsExibeCidade = mysql_fetch_assoc($rsExibeCidade));
$rows = mysql_num_rows($rsExibeCidade);
if($rows > 0) {
mysql_data_seek($rsExibeCidade, 0);
$row_rsExibeCidade = mysql_fetch_assoc($rsExibeCidade);
}
?>
</select></td>
<td colspan="2"><select name="cidade" class="formularios" id="cidade">
<option value="unselect">Selecione uma cidade</option>
<?php
do {
?>
<option value="<?php echo $row_rsExibeCidade['cidade']?>"><?php echo $row_rsExibeCidade['cidade']?></option>
<?php
} while ($row_rsExibeCidade = mysql_fetch_assoc($rsExibeCidade));
$rows = mysql_num_rows($rsExibeCidade);
if($rows > 0) {
mysql_data_seek($rsExibeCidade, 0);
$row_rsExibeCidade = mysql_fetch_assoc($rsExibeCidade);
}
?>
</select></td>
</tr>
<tr>
<td colspan="2"><input name="buscar" type="submit" class="formularios" id="buscar" value="Procurar"></td>
<td colspan="2"> </td>
</tr>
</table>
</form>
busca_resposta.php
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_rsExibePM = 5;
$pageNum_rsExibePM = 0;
if (isset($_GET['pageNum_rsExibePM'])) {
$pageNum_rsExibePM = $_GET['pageNum_rsExibePM'];
}
$startRow_rsExibePM = $pageNum_rsExibePM * $maxRows_rsExibePM;
mysql_select_db($database_AcheiGuia, $AcheiGuia);
$query_rsExibePM = "SELECT * FROM publicidade_mini WHERE ativo = 'Sim' ORDER BY idpublicidade_mini DESC";
$query_limit_rsExibePM = sprintf("%s LIMIT %d, %d", $query_rsExibePM, $startRow_rsExibePM, $maxRows_rsExibePM);
$rsExibePM = mysql_query($query_limit_rsExibePM, $AcheiGuia) or die(mysql_error());
$row_rsExibePM = mysql_fetch_assoc($rsExibePM);
if (isset($_GET['totalRows_rsExibePM'])) {
$totalRows_rsExibePM = $_GET['totalRows_rsExibePM'];
} else {
$all_rsExibePM = mysql_query($query_rsExibePM);
$totalRows_rsExibePM = mysql_num_rows($all_rsExibePM);
}
$totalPages_rsExibePM = ceil($totalRows_rsExibePM/$maxRows_rsExibePM)-1;
mysql_select_db($database_AcheiGuia, $AcheiGuia);
$query_rsExibePromo = "SELECT * FROM promocao WHERE encerrada = 'Ativa' ORDER BY idPromocao DESC";
$rsExibePromo = mysql_query($query_rsExibePromo, $AcheiGuia) or die(mysql_error());
$row_rsExibePromo = mysql_fetch_assoc($rsExibePromo);
$totalRows_rsExibePromo = mysql_num_rows($rsExibePromo);
$maxRows_TMPExibeCliente = 30;
$pageNum_TMPExibeCliente = 0;
if (isset($_GET['pageNum_TMPExibeCliente'])) {
$pageNum_TMPExibeCliente = $_GET['pageNum_TMPExibeCliente'];
}
$startRow_TMPExibeCliente = $pageNum_TMPExibeCliente * $maxRows_TMPExibeCliente;
mysql_select_db($database_AcheiGuia, $AcheiGuia);
$query_TMPExibeCliente = "SELECT * FROM clientes ORDER BY NomeFantasia ASC";
$query_limit_TMPExibeCliente = sprintf("%s LIMIT %d, %d", $query_TMPExibeCliente, $startRow_TMPExibeCliente, $maxRows_TMPExibeCliente);
$TMPExibeCliente = mysql_query($query_limit_TMPExibeCliente, $AcheiGuia) or die(mysql_error());
$row_TMPExibeCliente = mysql_fetch_assoc($TMPExibeCliente);
if (isset($_GET['totalRows_TMPExibeCliente'])) {
$totalRows_TMPExibeCliente = $_GET['totalRows_TMPExibeCliente'];
} else {
$all_TMPExibeCliente = mysql_query($query_TMPExibeCliente);
$totalRows_TMPExibeCliente = mysql_num_rows($all_TMPExibeCliente);
}
$totalPages_TMPExibeCliente = ceil($totalRows_TMPExibeCliente/$maxRows_TMPExibeCliente)-1;
?><html>
<head>
<title>Seja Bem Vindo ao Achei no Guia</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="css/css.css" rel="stylesheet" type="text/css">
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td align="center" valign="top"><table id="Table_01" width="981" height="900" border="0" cellpadding="0" cellspacing="0">
<tr>
<td rowspan="4" valign="top" background="imagens/index/Index_09.jpg"><img src="imagens/index/Index_01.jpg" width="19" height="841" alt=""></td>
<td colspan="3"><img src="imagens/index/Index_02.jpg" width="944" height="12" alt=""></td>
<td rowspan="5" valign="top" background="imagens/index/Index_10.jpg"><img src="imagens/index/Index_03.jpg" width="17" height="846" alt=""></td>
<td><img src="imagens/index/spacer.gif" width="1" height="12" alt=""></td>
</tr>
<tr>
<td><img src="imagens/index/Index_04.jpg" width="217" height="109" alt=""></td>
<td colspan="2" rowspan="2"><img src="imagens/index/Index_05.jpg" width="727" height="289" alt=""></td>
<td><img src="imagens/index/spacer.gif" width="1" height="109" alt=""></td>
</tr>
<tr>
<td rowspan="4" align="center" valign="top"><table id="Table_" width="217" height="317" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5"><img src="imagens/menu/menu_01.jpg" width="217" height="12" alt=""></td>
</tr>
<tr>
<td rowspan="22"><img src="imagens/menu/menu_02.jpg" width="10" height="303" alt=""></td>
<td colspan="3" background="imagens/menu/menu_03.jpg"><table width="195" height="32" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="menu_grande">Areas</td>
</tr>
</table>
</div></td>
</tr>
</table></td>
<td rowspan="22"><img src="imagens/menu/menu_04.jpg" width="12" height="303" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2"><img src="imagens/menu/menu_05.jpg" width="54" height="17" alt=""></td>
<td background="imagens/menu/menu_06.jpg" class="menu_pequeno">Nossa Empresa</td>
</tr>
<tr>
<td><img src="imagens/menu/menu_07.jpg" width="141" height="1" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2"><img src="imagens/menu/menu_08.jpg" width="54" height="17" alt=""></td>
<td background="imagens/menu/menu_09.jpg" class="menu_pequeno">Assinates</td>
</tr>
<tr>
<td><img src="imagens/menu/menu_10.jpg" width="141" height="1" alt=""></td>
</tr>
<tr>
<td colspan="2"><img src="imagens/menu/menu_11.jpg" width="54" height="16" alt=""></td>
<td background="imagens/menu/menu_12.jpg" class="menu_pequeno"><a href="#" class="menu_pequeno">Informativos</a></td>
</tr>
<tr>
<td colspan="3" background="imagens/menu/menu_13.jpg"><table width="195" height="36" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="menu_grande">Servicos</td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" rowspan="2"><img src="imagens/menu/menu_14.jpg" width="54" height="17" alt=""></td>
<td background="imagens/menu/menu_15.jpg" class="menu_pequeno">Busca Avançada</td>
</tr>
<tr>
<td><img src="imagens/menu/menu_16.jpg" width="141" height="1" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2"><img src="imagens/menu/menu_17.jpg" width="54" height="17" alt=""></td>
<td background="imagens/menu/menu_18.jpg" class="menu_pequeno">Serviços</td>
</tr>
<tr>
<td><img src="imagens/menu/menu_19.jpg" width="141" height="1" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2"><img src="imagens/menu/menu_20.jpg" width="54" height="17" alt=""></td>
<td background="imagens/menu/menu_21.jpg" class="menu_pequeno">Comércio</td>
</tr>
<tr>
<td><img src="imagens/menu/menu_22.jpg" width="141" height="1" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2"><img src="imagens/menu/menu_23.jpg" width="54" height="17" alt=""></td>
<td background="imagens/menu/menu_24.jpg" class="menu_pequeno">Indústria</td>
</tr>
<tr>
<td><img src="imagens/menu/menu_25.jpg" width="141" height="1" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2"><img src="imagens/menu/menu_26.jpg" width="54" height="17" alt=""></td>
<td background="imagens/menu/menu_27.jpg" class="menu_pequeno">Internet</td>
</tr>
<tr>
<td><img src="imagens/menu/menu_28.jpg" width="141" height="1" alt=""></td>
</tr>
<tr>
<td colspan="2"><img src="imagens/menu/menu_29.jpg" width="54" height="16" alt=""></td>
<td background="imagens/menu/menu_30.jpg" class="menu_pequeno">Informativos</td>
</tr>
<tr>
<td colspan="3"><table width="195" height="40" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="imagens/menu/menu_31.jpg"><div align="center">
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="menu_grande">Entre em Contato</td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"><img src="imagens/menu/menu_32.jpg" width="195" height="20" alt=""></td>
</tr>
<tr>
<td><img src="imagens/menu/menu_33.jpg" width="19" height="20" alt=""></td>
<td colspan="2" class="menu_grande">Publicidade</td>
</tr>
<tr>
<td height="4" colspan="3"><img src="imagens/menu/menu_35.jpg" width="195" height="4" alt=""></td>
</tr>
<tr>
<td height="2"><img src="imagens/menu/spacer.gif" width="10" height="1" alt=""></td>
<td><img src="imagens/menu/spacer.gif" width="19" height="1" alt=""></td>
<td><img src="imagens/menu/spacer.gif" width="35" height="1" alt=""></td>
<td><img src="imagens/menu/spacer.gif" width="141" height="1" alt=""></td>
<td><img src="imagens/menu/spacer.gif" width="12" height="1" alt=""></td>
</tr>
</table>
<p>
<?php if ($totalRows_rsExibePM > 0) { // Show if recordset not empty ?>
<?php do { ?>
<a href="<?php echo $row_rsExibePM['site']; ?>" target="_blank"><img src="admin/images/publi_mini/<?php echo $row_rsExibePM['imagem']; ?>" alt="<?php echo $row_rsExibePM['resumo_atividades']; ?>" width="200" height="60" border="0"></a><br>
<br>
<?php } while ($row_rsExibePM = mysql_fetch_assoc($rsExibePM)); ?>
<?php } // Show if recordset not empty ?>
</p>
<?php if ($totalRows_rsExibePM == 0) { // Show if recordset empty ?>
<p class="txt_antencao">Sem MINI Banner de Publicidade<br>
Cadastrados.</p>
<?php } // Show if recordset empty ?>
</td>
<td><img src="imagens/index/spacer.gif" width="1" height="180" alt=""></td>
</tr>
<tr>
<td rowspan="3" valign="top"><table width="717" border="0" cellspacing="0" cellpadding="5">
<tr>
<td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" align="center" valign="top"><div align="left">
<p><span class="menu_grande">Resultado de Busca</span><br>
<span class="txt_normal">Procurando por:
<?
$inc=0;
$resp=$_GET['resp'];
if ($resp == "0"){
$bsc = Rmlatin($_GET['text']);
$cidade =Rmlatin($_GET['cidade']);
}else{
$bsc = Rmlatin($_POST['text']);
$cidade =Rmlatin($_POST['cidade']);
}
print "$bsc"; ?>
<br>
</span><a href="index.php" class="txt_normal">voltar</a><br>
</p>
<?php
function Rmlatin($Msg)
{
$a = array(
'/[ÂÀÁÄÃ]/'=>'A',
'/[âãàáä]/'=>'a',
'/[ÊÈÉË]/'=>'E',
'/[êèéë]/'=>'e',
'/[ÎÍÌÏ]/'=>'I',
'/[îíìï]/'=>'i',
'/[ÔÕÒÓÖ]/'=>'O',
'/[ôõòóö]/'=>'o',
'/[ÛÙÚÜ]/'=>'U',
'/[ûúùü]/'=>'u',
'/ç/'=>'c',
'/Ç/'=> 'C');
return preg_replace(array_keys($a), array_values($a), $Msg);
}
$con=mysql_connect($hostname_AcheiGuia, $username_AcheiGuia , $password_AcheiGuia);
mysql_select_db($database_AcheiGuia,$con);
if ($bsc != "" ) {
if ($cidade != "unselect") { $sql="SELECT * FROM `clientes` WHERE `CidadeCliente` = '$cidade' ";
}else { $sql="SELECT * FROM `clientes` ";} $exec=mysql_query ($sql);
while ($dados = mysql_fetch_array($exec))
{
$NomeFantasia = $dados["NomeFantasia"];
$Servicos = $dados["Servicos"];
$ResumoServicos = $dados["ResumoServicos"];
$Bairro = $dados["Bairro"];
$global=" $NomeFantasia $Servicos $ResumoServicos $Bairro ";
$global= Rmlatin($global);
$global= strtoupper($global);
$bsc= strtoupper($bsc);
$pos= strpos($global, $bsc);
if ($pos != 0 )
{
$inc=$inc+1;
$null_l="0";
?>
<table width="95%" border="1" cellpadding="3" cellspacing="3" bordercolor="#FFFFFF">
<tr>
<td width="7%" valign="top" bordercolor="c3c3c3" bgcolor="#F0F0F0"><a href="busca_banner.php?idClientes=<?php print $dados["idClientes"];?>&text=<? print $text;?>&cidade=<? print $cidade;?>"><img src="admin/images/clientes/<?php print $dados["IMG_Pequena"]; ?>" alt="Ver Banner" border="0"></a></td>
<td width="93%" align="left" valign="top" bordercolor="c3c3c3" bgcolor="#F0F0F0"><span class="menu_grande"><?php print $dados["NomeFantasia"]; ?></span><br>
<span class="txt_normal"> Rua: <?php print $dados["Rua"]; ?>
Bairro: <?php print $dados["Bairro"]; ?> Número:
<?php print $dados["Numero"]; ?> Sala: <?php print $dados["Sala"]; ?><br>
<br>
Fax: <?php print $dados["Fax"]; ?><br>
Telefone: <?php print $dados["Telefone"]; ?><br>
Site: <a href="<?php print $dados["Site"]; ?>" target="_blank" class="txt_normal"><?php print $dados["Site"]; ?></a><br>
E-mail: <a href="mailto:<?php print $dados["Email"]; ?>" class="txt_normal"><?php print $dados["Email"]; ?></a>
<br>
<br>
<?php print $dados["ResumoServicos"]; ?><br>
<br>
<a href="busca_banner.php?idClientes=<?php print $dados["idClientes"];?>&text=<? print $text;?>&cidade=<? print $cidade;?>" class="txt_normal">Ver
Banner</a> - <a href="busca_detalhes.php?idClientes=<?php print $dados["idClientes"]; ?>&text=<? print $text;?>&cidade=<? print $cidade;?>" class="txt_normal">Mais
Detalhes</a> </span></td>
</tr>
</table>
<?
}
}
}
if ($null_l != "0") {
?>
<font color="#FF0000" class="txt_antencao">Sem resultados </font>
<? } ?>
</div></td>
</tr>
<tr>
<td width="71%" align="center" valign="top"><a href="index.php" class="txt_normal">voltar</a>
</td>
<td width="29%" align="center" valign="top"><span class="txt_normal">Encontrados
<? print "$inc"; ?> resultados</span> </td>
</tr>
</table></td>
</tr>
</table>
</td>
<td rowspan="3" valign="top" background="imagens/index/Index_08.jpg"><img src="imagens/index/Index_08.jpg" width="10" height="570" alt=""></td>
<td><img src="imagens/index/spacer.gif" width="1" height="540" alt=""></td>
</tr>
<tr>
<td rowspan="2" background="imagens/index/Index_09.jpg"><img src="imagens/index/Index_09.jpg" width="19" height="30" alt=""></td>
<td><img src="imagens/index/spacer.gif" width="1" height="5" alt=""></td>
</tr>
<tr>
<td background="imagens/index/Index_10.jpg"> </td>
<td><img src="imagens/index/spacer.gif" width="1" height="25" alt=""></td>
</tr>
<tr>
<td colspan="5"><img src="imagens/index/Index_11.jpg" width="980" height="29" alt=""></td>
<td><img src="imagens/index/spacer.gif" width="1" height="29" alt=""></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rsExibePM);
mysql_free_result($rsExibePromo);
mysql_free_result($TMPExibeCliente);
?>
result.php
<?
print "[";
require_once('../arquivo de conexão);
$uf = $_GET['uf'];
$uf=strtoupper($uf);
mysql_select_db($database_AcheiGuia, $AcheiGuia);
$query_rsExibeCidade = "SELECT * FROM cidade WHERE `estado` = '$uf' COLLATE latin1_swedish_ci";
$rsExibeCidade = mysql_query($query_rsExibeCidade, $AcheiGuia) or die(mysql_error());
$row_rsExibeCidade = mysql_fetch_assoc($rsExibeCidade);
$totalRows_rsExibeCidade = mysql_num_rows($rsExibeCidade);
do {if ($inc != 0 ) { print ","; }
?>
'<? print $row_rsExibeCidade['cidade']; ?>'
<?
$inc= $inc+1;
} while ($row_rsExibeCidade = mysql_fetch_assoc($rsExibeCidade));
$rows = mysql_num_rows($rsExibeCidade);
if($rows > 0) {
mysql_data_seek($rsExibeCidade, 0);
$row_rsExibeCidade = mysql_fetch_assoc($rsExibeCidade);
}
print "]";
?>bsc.php
<?php
require_once('../Arquivo de Conexão);
function Rmlatin($Msg)
{
$a = array(
'/[ÂÀÁÄÃ]/'=>'A',
'/[âãàáä]/'=>'a',
'/[ÊÈÉË]/'=>'E',
'/[êèéë]/'=>'e',
'/[ÎÍÌÏ]/'=>'I',
'/[îíìï]/'=>'i',
'/[ÔÕÒÓÖ]/'=>'O',
'/[ôõòóö]/'=>'o',
'/[ÛÙÚÜ]/'=>'U',
'/[ûúùü]/'=>'u',
'/ç/'=>'c',
'/Ç/'=> 'C');
return preg_replace(array_keys($a), array_values($a), $Msg);
}
$con=mysql_connect($hostname_AcheiGuia, $username_AcheiGuia , $password_AcheiGuia);
mysql_select_db($database_AcheiGuia,$con);
$bsc = Rmlatin($_POST['text']);
$cidade =Rmlatin($_POST['cidade']);
if ($bsc != "" ) {
if ($cidade != "") { $sql="SELECT * FROM `clientes` WHERE `CidadeCliente` = '$cidade' ";
}else { $sql="SELECT * FROM `clientes` ";} $exec=mysql_query ($sql);
while ($dados = mysql_fetch_array($exec))
{
$NomeFantasia = $dados["NomeFantasia"];
$Servicos = $dados["Servicos"];
$ResumoServicos = $dados["ResumoServicos"];
$Bairro = $dados["Bairro"];
$global=" $NomeFantasia $Servicos $ResumoServicos $Bairro ";
$global= Rmlatin($global);
$global= strtoupper($global);
$bsc= strtoupper($bsc);
$pos= strpos($global, $bsc);
if ($pos != 0 )
{
?>
<li><a href="index.php?item_selc=<? print $dados["NomeFantasia"];?>" ><? print $dados["NomeFantasia"];?></a></li>
<?
}
}
}
?>
Discussão (4)
Carregando comentários...