Olá pessoal ..
Usei um list/menu do dream com list dinamic
mas ele mostra a lista pra cima e não pra baixo.....eu to falando de como a janela abre e não da ordenação dos dados ..
A janela abre pra cima ....como faço pra ele abrir a lista pra baixo ??
- Fórum WMO
- → Viewing Profile: Tópicos: gajowebmaster
Community Stats
- Group Usuários
- Active Posts 8
- Profile Views 2743
- Member Title Novato no fórum
- Age Age Unknown
- Birthday Birthday Unknown
-
Sexo
Não informado
0
Neutral
User Tools
Topics I've Started
List/menu Dinamico
10/01/2009, 13:12
Jumpmenu
12/12/2008, 11:08
ola pessoal tenho que fazer um jumpmenu ond eo cliente seleciona uma categoria e na proxima pagina aparece todos resultado do select. ja tentei com componente do dream e con esse codigo ....
ta retornando
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'form servicos set categoria1 = ''' at line 1
parece que ta enviando a variavel vazio o select da pagina de resultados ta assim
$q1 = "select * form servicos set categoria1 = '$_POST[f1]' ";
mysql_query($q1) or die(mysql_error());
print $f1;
exit();
[codebox]<?
require_once("configuracao_mysql.php");
?>
<br><br>
<form method=post name=f1 action = "resultadocategorias.php";>
<table align=center>
<tr>
<td colspan=2 align=center class=TableHead> </td>
</tr>
<tr>
<td>Selecione a categoria:</td>
<td>
<? //get the categories
$q1 = "select * from servicos_categ order by nome_categoria";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) == '0')
{
echo "<br><center><font color=red face=verdana size=2><b>Não existem categorias!</b></font>";
exit();
}
else
{
$SelectCategory = "<select name=CategoriesList>\n\t<option value=\"\"></option>\n\t";
while($a1 = mysql_fetch_array($r1))
{
$SelectCategory .= "<option value=\"$a1[id_categoria]\">$a1[nome_categoria]</option>\n\t";
}
$SelectCategory .= "</select>";
?> </td>
</tr>
<tr>
<td> </td>
<td><input name=s1 type=submit class=sub value="Buscar"></td>
</tr>
</table>
</form>
<?
}
?>[/codebox]
ta retornando
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'form servicos set categoria1 = ''' at line 1
parece que ta enviando a variavel vazio o select da pagina de resultados ta assim
$q1 = "select * form servicos set categoria1 = '$_POST[f1]' ";
mysql_query($q1) or die(mysql_error());
print $f1;
exit();
[codebox]<?
require_once("configuracao_mysql.php");
?>
<br><br>
<form method=post name=f1 action = "resultadocategorias.php";>
<table align=center>
<tr>
<td colspan=2 align=center class=TableHead> </td>
</tr>
<tr>
<td>Selecione a categoria:</td>
<td>
<? //get the categories
$q1 = "select * from servicos_categ order by nome_categoria";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) == '0')
{
echo "<br><center><font color=red face=verdana size=2><b>Não existem categorias!</b></font>";
exit();
}
else
{
$SelectCategory = "<select name=CategoriesList>\n\t<option value=\"\"></option>\n\t";
while($a1 = mysql_fetch_array($r1))
{
$SelectCategory .= "<option value=\"$a1[id_categoria]\">$a1[nome_categoria]</option>\n\t";
}
$SelectCategory .= "</select>";
?> </td>
</tr>
<tr>
<td> </td>
<td><input name=s1 type=submit class=sub value="Buscar"></td>
</tr>
</table>
</form>
<?
}
?>[/codebox]
Select
28/10/2008, 16:58
como eu poderia escrever o seguinte codigo para que ele retorne o numero de linhas mas so do resultado onde o campo "palavras" seja igual a $campobusca3 mas que a coluna categoria1 seja diferente de pessoa fisica.
[codebox]$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) ORDER BY nivel DESC, Score DESC");
} elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3'");
}
$rego = mysql_num_rows($sqlrop);
?><?=$rego;?> registro(s).</span></td>[/codebox]
Tentei assim mas não mudou nada ele continua contando os registro que tem o campo categoria1 = a pessoa fisica
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) ORDER BY nivel DESC, Score DESC");
} elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3' and categoria1 !='Pessoa Física'");
}
Consegui assim
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) and (tipo!='Pessoa Física') ORDER BY nivel DESC, Score DESC");
[codebox]$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) ORDER BY nivel DESC, Score DESC");
} elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3'");
}
$rego = mysql_num_rows($sqlrop);
?><?=$rego;?> registro(s).</span></td>[/codebox]
Tentei assim mas não mudou nada ele continua contando os registro que tem o campo categoria1 = a pessoa fisica
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) ORDER BY nivel DESC, Score DESC");
} elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3' and categoria1 !='Pessoa Física'");
}
Consegui assim
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) and (tipo!='Pessoa Física') ORDER BY nivel DESC, Score DESC");
Sistema De Busca
27/10/2008, 11:42
pessoal to com um problema no sistema de busca as palavras com mens de tres letras não aparece na primeira pagina so nas ultimas ....
[codebox]<?php
include( 'adm/config.php');
include( 'adm/lampiao.php');
include( 'adm/class/class.enquete.php');
include( 'adm/class/class.enquetee.php');
include( 'adm/class/class.banners.php');
include_once( "adm/funcoes.php");
$lampiao = new Lampiao();
$in = mysql_query("SELECT * FROM canais where id = '$idd' and lixo='n' and disp='s'") or die("Erro SQL: ".mysql_error());
while ($inl=mysql_fetch_array($in)) {
$canal = $inl["canal"];
}
if($canal == "") { $canal = "paginicial"; }
$banner = new Banner("$canal");
$campobusca2 = trim( $campobusca);
$campobusca2= strtolower($campobusca2);
$campobusca3 = ",".$campobusca.",";
$campobusca = trim( $campobusca);
$campobusca = str_replace(" "," +","$campobusca");
$campobusca = "+".$campobusca;
if($campobusca == "") {
echo("<script>alert(\"O campo busca não foi preenchido.\"); window.location = 'java script:history.back(-1)'; </script>");
}
elseif(strlen($campobusca)<=1){
echo("<script>alert(\"O campo busca precisa ter mais de 1 caracteres.\"); window.location = 'java script:history.back(-1)'; </script>");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR...nsitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>index.jpg</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
td img {display: block;}body {
background-color: #E8E8E8;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 17px;
font-weight: bold;
}
.style4 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style5 {font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: bold; }
.style11 {font-family: Arial, Helvetica, sans-serif; font-size: 11px; }
.style15 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #0000FF;
}
.style6 {font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;}
.style3 { font-size: 28px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
</style>
<!--Fireworks 8 Dreamweaver 8 target. Created Sat Aug 02 02:19:37 GMT-0300 (Hora oficial do Brasil) 2008-->
</head>
<body>
<table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<!-- fwtable fwsrc="index.png" fwbase="index.jpg" fwstyle="Dreamweaver" fwdocid = "1479144753" fwnested="0" -->
<tr>
<td><img src="imagens/spacer.gif" width="10" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="148" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="94" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="215" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="246" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="10" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="6" rowspan="5"><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td align="center" bgcolor="#FEFEFE"><table width="703" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="703" height="134" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macr...rsion=7,0,19,0" width="703" height="134">
<param name="movie" value="banner.swf" />
<param name="quality" value="high" />
<embed src="banner.swf" quality="high" pluginspage="http://www.macromedi...getflashplayer" type="application/x-shockwave-flash" width="709" height="134"></embed>
</object></td>
</tr>
</table></td>
<td> </td>
</tr>
</table></td>
<td><img src="imagens/spacer.gif" width="1" height="6" border="0" alt="" /></td>
</tr>
<tr>
<td><img src="imagens/spacer.gif" width="1" height="31" border="0" alt="" /></td>
</tr>
<tr>
<td><img src="imagens/spacer.gif" width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td><img src="imagens/spacer.gif" width="1" height="24" border="0" alt="" /></td>
</tr>
<tr>
<td><img src="imagens/spacer.gif" width="1" height="27" border="0" alt="" /></td>
</tr>
<tr>
<td> </td>
<td colspan="4" align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="77" align="center">
<table width="95%" height="59" border="0" cellpadding="0" cellspacing="0">
<tr>
<form id="form1" name="form1" method="post" action="resultado.php"><td align="left"><table width="436" height="48" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC" background-repeat="no repeat" >
<tr>
<td width="324" align="right"><div align="right">
<input name="campobusca" type="text" id="campobusca" style="width:300px" />
</div></td>
<td width="107" align="left"><input name="image" type="image" src="imagens/pesq.gif" align="left" width="70" height="21" /></td>
</tr>
</table></td>
</form>
</tr>
</table>
<table width="95%" height="26" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="26" class="style1">Resultados da busca </td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="22"><span class="style4">A busca por <strong><?=$campobusca2;?></strong> resultou <?
$numero=strlen($campobusca2);
if($campobusca2 == "disk gas" or $campobusca2 == "disk gás") {
$bi = ",gas,";
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$bi'");
}
elseif($numero > 3) {
//SE HA UMA FRASE SE UTILIZA O ALGORTIMO DE BUSCA AVANCADO DE MATCH AGAINST
//busca de frases com mais de uma palavra e um algoritmo especializado
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) ORDER BY nivel DESC, Score DESC");
} elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3'");
}
$rego = mysql_num_rows($sqlrop);
?><?=$rego;?> registro(s).</span></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"><table width="120" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"><img src="imagens/spacer.gif" width="1" height="10" /></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="95%" height="291" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="291" valign="top">
<?php
//CONTA O NUMERO DE PALAVRAS
$numero=strlen($campobusca2);
if($campobusca2 == "disk gas" or $campobusca2 == "disk gás") {
$bi = ",gas,";
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$bi' order by nivel desc");
}
elseif($numero > 3) {
//SE HA UMA FRASE SE UTILIZA O ALGORTIMO DE BUSCA AVANCADO DE MATCH AGAINST
//busca de frases com mais de uma palavra e um algoritmo especializado
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras,telefone ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras,telefone) AGAINST ( '$campobusca' IN BOOLEAN MODE) and (tipo!='Pessoa Física') ORDER BY nivel DESC, Score DESC");
}
elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3' order by nivel desc");
}
?>
<?
$lpp = 10; // Especifique quantos resultados você quer por página
$total = mysql_num_rows($sqlrop); // Esta função irá retornar o total de linhas na tabela
$paginas = ceil($total / $lpp); // Retorna o total de páginas
if(!isset($pagina)) { $pagina = 1; }
else { $paginaa = $pagina - 1; }// Especifica uma valor para variavel pagina caso a mesma não esteja setada
$inicio = $paginaa * $lpp; // Retorna qual será a primeira linha a ser mostrada no MySQL
//CONTA O NUMERO DE PALAVRAS
$numero=strlen($campobusca2);
if($campobusca2 == "disk gas" or $campobusca2 == "disk gás") {
$bi = ",gas,";
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$bi' order by nivel desc LIMIT $inicio, $lpp");
}
elseif($numero > 3) {
//SE HA UMA FRASE SE UTILIZA O ALGORTIMO DE BUSCA AVANCADO DE MATCH AGAINST
//busca de frases com mais de uma palavra e um algoritmo especializado
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) and (tipo!='Pessoa Física') ORDER BY Nivel desc, Score DESC LIMIT $inicio, $lpp");
}
elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3' order by nivel desc LIMIT $inicio, $lpp");
}
$i=0;
while ($resultado =mysql_fetch_object($sqlrop))
{
$_score = $resultado->Score;
$_tipo = $resultado->tipo;
$_id = $resultado->id;
$_desc1 = $resultado->desc1;
$_site = $resultado->site;
$_nivel = $resultado->nivel;
$_telefone = $resultado->telefone;
$_bairro = $resultado->bairro;
if ($_bairro != "") { $_bairrro = "/"." $_bairro"; }
$_endereco = $resultado->endereco;
$_nivel = $resultado->nivel;
if($_nivel == "Nível 04" or $_nivel == "Nível 05") {
$_imagemlogo = $resultado->imagemlogo;
}else {
$_imagemlogo = $resultado->imagenlogo=("");
}
$_palavras = $resultado->palavras;
$_data = $resultado->data;
$_data = implode(preg_match("~\/~", $_data) == 0 ? "/" : "-", array_reverse(explode(preg_match("~\/~", $_data) == 0 ? "-" : "/", $_data)));
$_disp = $resultado->disp;
$_nome = $resultado->nome;
$_email = $resultado->email;
$_categoria1 = $resultado->categoria1;
$_categoria2 = $resultado->categoria2;
$_categoria3 = $resultado->categoria3;
$_categoria4 = $resultado->categoria4;
$_categoria5 = $resultado->categoria5;
$endereco = "imagens/".$_imagemlogo;
?>
<table cellpadding="0" cellspacing="0" <? if($_nivel == "Nível 05") { ?> bgcolor="#EFEFEF" <? } ?> style="border:solid; border:1px; border-color:#999999; border-style:solid;">
<tr>
<td><table width="100%" border="0" cellpadding="8" cellspacing="0" >
<tr>
<td width="340" valign="top"><span class="style5">
<? echo"$_nome";?>
</span> <br />
<span class="style11">
<?=$_desc1;?>
</span>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="13"><img src="imagens/spacer.gif" width="1" height="13" /></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="13"><span class="style11">
<?=$_endereco;?>
<? echo $_bairrro; ?>
/ Indaiatuba/SP</span></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="13"><span class="style11">Telefones:<strong>
<?=$_telefone;?>
</strong></span></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="23"><span class="style15">+
<? if($_site != "") {?>
<a href="<?=$_site;?>" target="_blank">Site</a> /
<? } if($_email != "") {?>
<a href="mailto:<?=$_email;?>" target="_blank">Email</a> /
<? }?><a href="map.php?idm=<?=$_id;?>">Mapa</a></span> </td>
</tr>
</table></td>
<td width="101" valign="top"><table width="120" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"><img src="imagens/spacer.gif" width="1" height="4" /></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="26"><? if ($_imagemlogo != "") { ?>
<? if ($_site != "")
{ ?> <a href="<?=$_site;?>" target="_blank" style="color:#999999"> <? } ?>
<img src="imagemdim.php?aa=120&imagem=<? echo "$endereco"; ?>" border="1" style="border-color:#999999"></a>
<? } ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20"><img src="imagens/spacer.gif" width="1" height="13" /></td>
</tr>
</table>
<?
$i++;
}
?>
<table width="93%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><? if ($total > $lpp) { ?>
<table width="614" height="30%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" class="style6"><? if ($total > $lpp) { ?>
<?
// Agora o mais importante, gera os links....
if ($pagina > 1) {
$menos = $pagina - 1;
$url = "$PHP_SELF?pagina=$menos&campobusca=$campobusca&tipo=$tipo";
print "<a href=\"$url\" style='text-decoration:none; color:#000000'>< Anterior</a> ";
} else {
print "< Anterior ";
}
?>
<? for($i = 1; $i <= $paginas; $i++) {
$em = $em + 1;
if ($pagina == $i) {
if ($em == "1") { print " <b>$i</b>"; }
elseif ($em != "1") {
print " | <b>$i</b>";
}
} else {
$url = "$PHP_SELF?pagina=$i&campobusca=$campobusca&tipo=$tipo";
if ($em == "1") { print " <a href=\"$url\" style='text-decoration: none;color:#000000'>$i</a>"; }
elseif ($em != "1") {
print " | <a href=\"$url\" style='text-decoration: none;color:#000000'>$i</a>";
}
}
}
?><?
// Agora o mais importante, gera os links....
if ($pagina <= ($paginas - 1)) {
$mais = $pagina + 1;
$url = "?pagina=$mais&campobusca=$campobusca&tipo=$tipo";
print " <a href=\"$url\" style='text-decoration:none;color:#000000'>Próxima ></a>";
} else {
print " Próxima >";
}
?><? } ?></td>
</tr>
</table>
<? } ?></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td></tr>
</table></td>
<td> </td>
<td><img src="imagens/spacer.gif" width="1" height="149" border="0" alt="" /></td>
</tr>
</table>
</body>
</html>[/codebox]
[codebox]<?php
include( 'adm/config.php');
include( 'adm/lampiao.php');
include( 'adm/class/class.enquete.php');
include( 'adm/class/class.enquetee.php');
include( 'adm/class/class.banners.php');
include_once( "adm/funcoes.php");
$lampiao = new Lampiao();
$in = mysql_query("SELECT * FROM canais where id = '$idd' and lixo='n' and disp='s'") or die("Erro SQL: ".mysql_error());
while ($inl=mysql_fetch_array($in)) {
$canal = $inl["canal"];
}
if($canal == "") { $canal = "paginicial"; }
$banner = new Banner("$canal");
$campobusca2 = trim( $campobusca);
$campobusca2= strtolower($campobusca2);
$campobusca3 = ",".$campobusca.",";
$campobusca = trim( $campobusca);
$campobusca = str_replace(" "," +","$campobusca");
$campobusca = "+".$campobusca;
if($campobusca == "") {
echo("<script>alert(\"O campo busca não foi preenchido.\"); window.location = 'java script:history.back(-1)'; </script>");
}
elseif(strlen($campobusca)<=1){
echo("<script>alert(\"O campo busca precisa ter mais de 1 caracteres.\"); window.location = 'java script:history.back(-1)'; </script>");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR...nsitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>index.jpg</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
td img {display: block;}body {
background-color: #E8E8E8;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 17px;
font-weight: bold;
}
.style4 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style5 {font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: bold; }
.style11 {font-family: Arial, Helvetica, sans-serif; font-size: 11px; }
.style15 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #0000FF;
}
.style6 {font-size: 12px; color: #000000; font-family: Arial, Helvetica, sans-serif;}
.style3 { font-size: 28px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
</style>
<!--Fireworks 8 Dreamweaver 8 target. Created Sat Aug 02 02:19:37 GMT-0300 (Hora oficial do Brasil) 2008-->
</head>
<body>
<table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<!-- fwtable fwsrc="index.png" fwbase="index.jpg" fwstyle="Dreamweaver" fwdocid = "1479144753" fwnested="0" -->
<tr>
<td><img src="imagens/spacer.gif" width="10" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="148" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="94" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="215" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="246" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="10" height="1" border="0" alt="" /></td>
<td><img src="imagens/spacer.gif" width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="6" rowspan="5"><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td align="center" bgcolor="#FEFEFE"><table width="703" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="703" height="134" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macr...rsion=7,0,19,0" width="703" height="134">
<param name="movie" value="banner.swf" />
<param name="quality" value="high" />
<embed src="banner.swf" quality="high" pluginspage="http://www.macromedi...getflashplayer" type="application/x-shockwave-flash" width="709" height="134"></embed>
</object></td>
</tr>
</table></td>
<td> </td>
</tr>
</table></td>
<td><img src="imagens/spacer.gif" width="1" height="6" border="0" alt="" /></td>
</tr>
<tr>
<td><img src="imagens/spacer.gif" width="1" height="31" border="0" alt="" /></td>
</tr>
<tr>
<td><img src="imagens/spacer.gif" width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td><img src="imagens/spacer.gif" width="1" height="24" border="0" alt="" /></td>
</tr>
<tr>
<td><img src="imagens/spacer.gif" width="1" height="27" border="0" alt="" /></td>
</tr>
<tr>
<td> </td>
<td colspan="4" align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="77" align="center">
<table width="95%" height="59" border="0" cellpadding="0" cellspacing="0">
<tr>
<form id="form1" name="form1" method="post" action="resultado.php"><td align="left"><table width="436" height="48" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC" background-repeat="no repeat" >
<tr>
<td width="324" align="right"><div align="right">
<input name="campobusca" type="text" id="campobusca" style="width:300px" />
</div></td>
<td width="107" align="left"><input name="image" type="image" src="imagens/pesq.gif" align="left" width="70" height="21" /></td>
</tr>
</table></td>
</form>
</tr>
</table>
<table width="95%" height="26" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="26" class="style1">Resultados da busca </td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="22"><span class="style4">A busca por <strong><?=$campobusca2;?></strong> resultou <?
$numero=strlen($campobusca2);
if($campobusca2 == "disk gas" or $campobusca2 == "disk gás") {
$bi = ",gas,";
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$bi'");
}
elseif($numero > 3) {
//SE HA UMA FRASE SE UTILIZA O ALGORTIMO DE BUSCA AVANCADO DE MATCH AGAINST
//busca de frases com mais de uma palavra e um algoritmo especializado
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) ORDER BY nivel DESC, Score DESC");
} elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3'");
}
$rego = mysql_num_rows($sqlrop);
?><?=$rego;?> registro(s).</span></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"><table width="120" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"><img src="imagens/spacer.gif" width="1" height="10" /></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="95%" height="291" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="291" valign="top">
<?php
//CONTA O NUMERO DE PALAVRAS
$numero=strlen($campobusca2);
if($campobusca2 == "disk gas" or $campobusca2 == "disk gás") {
$bi = ",gas,";
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$bi' order by nivel desc");
}
elseif($numero > 3) {
//SE HA UMA FRASE SE UTILIZA O ALGORTIMO DE BUSCA AVANCADO DE MATCH AGAINST
//busca de frases com mais de uma palavra e um algoritmo especializado
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras,telefone ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras,telefone) AGAINST ( '$campobusca' IN BOOLEAN MODE) and (tipo!='Pessoa Física') ORDER BY nivel DESC, Score DESC");
}
elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3' order by nivel desc");
}
?>
<?
$lpp = 10; // Especifique quantos resultados você quer por página
$total = mysql_num_rows($sqlrop); // Esta função irá retornar o total de linhas na tabela
$paginas = ceil($total / $lpp); // Retorna o total de páginas
if(!isset($pagina)) { $pagina = 1; }
else { $paginaa = $pagina - 1; }// Especifica uma valor para variavel pagina caso a mesma não esteja setada
$inicio = $paginaa * $lpp; // Retorna qual será a primeira linha a ser mostrada no MySQL
//CONTA O NUMERO DE PALAVRAS
$numero=strlen($campobusca2);
if($campobusca2 == "disk gas" or $campobusca2 == "disk gás") {
$bi = ",gas,";
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$bi' order by nivel desc LIMIT $inicio, $lpp");
}
elseif($numero > 3) {
//SE HA UMA FRASE SE UTILIZA O ALGORTIMO DE BUSCA AVANCADO DE MATCH AGAINST
//busca de frases com mais de uma palavra e um algoritmo especializado
$sqlrop = mysql_query("SELECT * , MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) AS Score FROM cad WHERE MATCH ( nome, categoria1, palavras ) AGAINST ( '$campobusca' IN BOOLEAN MODE) and (tipo!='Pessoa Física') ORDER BY Nivel desc, Score DESC LIMIT $inicio, $lpp");
}
elseif($numero < 4) {
$sqlrop = mysql_query("SELECT * from cad WHERE palavras REGEXP '$campobusca3' order by nivel desc LIMIT $inicio, $lpp");
}
$i=0;
while ($resultado =mysql_fetch_object($sqlrop))
{
$_score = $resultado->Score;
$_tipo = $resultado->tipo;
$_id = $resultado->id;
$_desc1 = $resultado->desc1;
$_site = $resultado->site;
$_nivel = $resultado->nivel;
$_telefone = $resultado->telefone;
$_bairro = $resultado->bairro;
if ($_bairro != "") { $_bairrro = "/"." $_bairro"; }
$_endereco = $resultado->endereco;
$_nivel = $resultado->nivel;
if($_nivel == "Nível 04" or $_nivel == "Nível 05") {
$_imagemlogo = $resultado->imagemlogo;
}else {
$_imagemlogo = $resultado->imagenlogo=("");
}
$_palavras = $resultado->palavras;
$_data = $resultado->data;
$_data = implode(preg_match("~\/~", $_data) == 0 ? "/" : "-", array_reverse(explode(preg_match("~\/~", $_data) == 0 ? "-" : "/", $_data)));
$_disp = $resultado->disp;
$_nome = $resultado->nome;
$_email = $resultado->email;
$_categoria1 = $resultado->categoria1;
$_categoria2 = $resultado->categoria2;
$_categoria3 = $resultado->categoria3;
$_categoria4 = $resultado->categoria4;
$_categoria5 = $resultado->categoria5;
$endereco = "imagens/".$_imagemlogo;
?>
<table cellpadding="0" cellspacing="0" <? if($_nivel == "Nível 05") { ?> bgcolor="#EFEFEF" <? } ?> style="border:solid; border:1px; border-color:#999999; border-style:solid;">
<tr>
<td><table width="100%" border="0" cellpadding="8" cellspacing="0" >
<tr>
<td width="340" valign="top"><span class="style5">
<? echo"$_nome";?>
</span> <br />
<span class="style11">
<?=$_desc1;?>
</span>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="13"><img src="imagens/spacer.gif" width="1" height="13" /></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="13"><span class="style11">
<?=$_endereco;?>
<? echo $_bairrro; ?>
/ Indaiatuba/SP</span></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="13"><span class="style11">Telefones:<strong>
<?=$_telefone;?>
</strong></span></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="23"><span class="style15">+
<? if($_site != "") {?>
<a href="<?=$_site;?>" target="_blank">Site</a> /
<? } if($_email != "") {?>
<a href="mailto:<?=$_email;?>" target="_blank">Email</a> /
<? }?><a href="map.php?idm=<?=$_id;?>">Mapa</a></span> </td>
</tr>
</table></td>
<td width="101" valign="top"><table width="120" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"><img src="imagens/spacer.gif" width="1" height="4" /></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="26"><? if ($_imagemlogo != "") { ?>
<? if ($_site != "")
{ ?> <a href="<?=$_site;?>" target="_blank" style="color:#999999"> <? } ?>
<img src="imagemdim.php?aa=120&imagem=<? echo "$endereco"; ?>" border="1" style="border-color:#999999"></a>
<? } ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20"><img src="imagens/spacer.gif" width="1" height="13" /></td>
</tr>
</table>
<?
$i++;
}
?>
<table width="93%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><? if ($total > $lpp) { ?>
<table width="614" height="30%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" class="style6"><? if ($total > $lpp) { ?>
<?
// Agora o mais importante, gera os links....
if ($pagina > 1) {
$menos = $pagina - 1;
$url = "$PHP_SELF?pagina=$menos&campobusca=$campobusca&tipo=$tipo";
print "<a href=\"$url\" style='text-decoration:none; color:#000000'>< Anterior</a> ";
} else {
print "< Anterior ";
}
?>
<? for($i = 1; $i <= $paginas; $i++) {
$em = $em + 1;
if ($pagina == $i) {
if ($em == "1") { print " <b>$i</b>"; }
elseif ($em != "1") {
print " | <b>$i</b>";
}
} else {
$url = "$PHP_SELF?pagina=$i&campobusca=$campobusca&tipo=$tipo";
if ($em == "1") { print " <a href=\"$url\" style='text-decoration: none;color:#000000'>$i</a>"; }
elseif ($em != "1") {
print " | <a href=\"$url\" style='text-decoration: none;color:#000000'>$i</a>";
}
}
}
?><?
// Agora o mais importante, gera os links....
if ($pagina <= ($paginas - 1)) {
$mais = $pagina + 1;
$url = "?pagina=$mais&campobusca=$campobusca&tipo=$tipo";
print " <a href=\"$url\" style='text-decoration:none;color:#000000'>Próxima ></a>";
} else {
print " Próxima >";
}
?><? } ?></td>
</tr>
</table>
<? } ?></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td></tr>
</table></td>
<td> </td>
<td><img src="imagens/spacer.gif" width="1" height="149" border="0" alt="" /></td>
</tr>
</table>
</body>
</html>[/codebox]
Busca No Php Com Input Do Flash
09/10/2008, 18:37
Tenho que fazer uma busca pelo php mas o campo ta no flash.
quando busca na pagina de resultado.php retorna 0 registro.
http://www.foneindai...br/inicial.html em flash não funciona
http://www.foneindaia.com.br em php funciona
quando busca na pagina de resultado.php retorna 0 registro.
http://www.foneindai...br/inicial.html em flash não funciona
http://www.foneindaia.com.br em php funciona
var campobusca = new LoadVars(); formulario.nome = campobusca.text; /*Ao precionar do botão pesquisa*/ pesquisa.onPress = function() { /*Valores a serem enviados*/ formulario.nome = campobusca.text; /*Enviando variáveis ao PHP e carregando as variáveis retornadas*/ formulario.send('resultado.php','_self','POST'); getURL('resultado.php?action=resustado.php','_self','POST'); };
- Fórum WMO
- → Viewing Profile: Tópicos: gajowebmaster
- Privacy Policy
- Regras ·