Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

designmix

busca com paginção

Recommended Posts

Galera fiz um busca que mostra o resultado na mesma pag.

 

o que acontece é que quando faço uma busca ele me mostra so a primeria a primeira pagina a segunda mostra em branco

 

mandei imprimi a a variavel paginas e me voto 1,33333333333333 tentei deixa como numero cint (vari)

 

ai a busca ão funciona

 

deixei no ar imprimindo para vcs olha

 

http://www.proactors.com.br/busca.asp

 

 

o que pode ser ???

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ai esta

 

<!--#include file="conn/bib_conexao.asp"--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><link href="busca.css" rel="stylesheet" type="text/css" /><link href="FolhaEstilo.css" rel="stylesheet" type="text/css" /><style type="text/css"><!--.style3 {color: #000000}.tdFotos {padding: 8px;}--></style><script type="text/JavaScript"><!--function MM_openBrWindow(theURL,winName,features) { //v2.0  window.open(theURL,winName,features);}//--></script></head><body><table width="400" height="400" border="0" cellpadding="0" cellspacing="0">  <tr>	<td width="400" height="400" valign="top" background="busca_proactors.jpg"><table width="100%" height="195" border="0" cellpadding="0" cellspacing="0">	  <tr>		<td width="364" height="195" valign="top"><form action="?acao=busca" method="post"  name="busca" id="busca">			  <table border="0" cellspacing="2" cellpadding="0">			<tr>			  <td height="75" colspan="9"> </td>			</tr>			<tr>			  <td width="56" height="27" valign="middle"><label for="textfield">				<span class="texto">Nome:</span>				</label></td>			  <td colspan="3" valign="middle"><input name="nome" type="text" class="campform6666" id="nome" style="width:150px;" /></td>			  <td width="44"><div align="center" class="texto">Cabelo:</div></td>			  <td colspan="4"><select name="cabelo" class="campform6666" id="cabelo" style="width:120px;" >				<option value="">Todos </option>				<option value="cast claro ">cast claro </option>				<option value="cast escuro ">cast escuro </option>				<option value="preto ">preto </option>				<option value="ruivos ">ruivos </option>				<option value="loiros ">loiros </option>			  </select></td>			</tr>			<tr>			  <td height="19"><div align="center" class="texto">Idade:</div></td>			  <td width="39" height="19"><input name="idade" type="text" class="campform6666" id="idade" style="width:30px;" maxlength="2"  /></td>			  <td width="37"><div align="right">Olhos:</div></td>			  <td width="72">				<div align="right">				  <input name="olhos" type="text" class="campform6666" id="olhos" style="width:70px;" />				</div></td><td height="19"><div align="center" class="texto">Cabelo:</div></td>			  <td height="19" colspan="4"><select name="Tipo" class="campform6666" id="select" style="width:120px;" >				<option value="" selected="selected">Tipo</option>				<option value="liso">Liso</option>				<option value="cacheado">Cacheado</option>				<option value="grisalho">Grisalho</option>			  </select></td>			</tr>			<tr>			  <td height="25" class="texto">Profissão:</td>			  <td height="25" colspan="3"><div align="left"><span class="texto">				<select name="profissao" class="campform6666" id="profissao" style="width:155px;">				 <option value="">Todos</option>				  <option value="modelos">Modelos</option>				  <option value="artistas">Artistas</option>				</select>			  </span></div></td>			  <td height="25" class="texto"><div align="center" class="texto">Pele:</div></td>			  <td height="25" colspan="4"><select class="campform6666" name="pele"  style="width:120px;">				<option value="">Todos </option>				<option value="clara">clara </option>				<option value="negra">negra </option>				<option value="morena">morena </option>				<option value="parda">parda </option>				<option value="outro">outro </option>			  </select></td>			  </tr>			<tr>			  <td height="18" valign="top" class="texto"> </td>			  <td height="18" colspan="3" valign="top" class="texto"> </td>			  <td height="18" valign="top" class="texto"><div align="center">Sexo:</div></td>			  <td width="42" height="18" valign="top" class="texto"><div align="right">				<input name="sexo2" type="checkbox" id="sexo2" value="Feminino">			  </div>				</td>			  <td width="15" height="18" class="texto"><div align="left">F</div></td>			  <td width="42" height="18" valign="top" class="texto"><div align="right">				<input name="sexo" type="checkbox" id="sexo" value="Masculino" />			  </div></td>			  <td width="15" height="18" class="texto"><div align="left">M</div></td>			</tr>			<tr>			  <td height="37" valign="top" class="texto"> </td>			  <td height="37" colspan="3" valign="top" class="texto"> </td>			  <td height="37" class="texto"> </td>			  <td height="37" colspan="4" class="texto"><input type="image" name="Submit" value="busca" src="bot.jpg"/></td>			</tr>		  </table>				</form>		</td>	  </tr>	</table><p>		<%	if request.querystring("acao") = "busca" then			nome	  = Trim(Request.form ("nome"))		cabelo	= Trim(Request.Form("cabelo"))		idade	 = Trim(Request.Form("idade"))		tipo	  = Request.Form("tipo")		olhos	 = Request.Form("olhos")		sexo	  = Request.Form("sexo")		pele	  = Request.Form("pele")		profissao = Request.Form("profissao")StrSQl = "Select * FROM cadastro Where nome like '%" & nome & "%' and cabelo like '%" & cabelo & "%' and tipo like '%" & tipo & "%' and idade like '%" & idade & "%' and olhos like '%" & olhos & "%' and sexo like '%" & sexo & "%' and pele like '%" & pele & "%' and profissao like '%" & profissao & "%' "Call abre_conexaoSet rsBusca = conn.Execute (StrSQl) 	%>	<table width="96%" height="90" border="0" cellpadding="0" cellspacing="1">   <tr>	 <td width="46%" height="14" valign="top"><p> </p>		 </td>	 <td width="54%" valign="top"><% If rsBusca.EOF  then 		  response.write("<img src='nada.gif' width='116' height='16' />")		   Else%></td>   </tr>   <tr>	 <td height="36" colspan="2" valign="top">	 <table border="0" cellpadding="0" cellspacing="1" bgcolor="#ECE9D8">		 <%		 Call abre_conexao 	sqls = "SELECT COUNT(*) as total FROM cadastro WHERE foto_p <> '' AND foto_g <> ''"				  set rs = conn.execute(sqls)					  numero_fotos = rs("total")				  set rs = nothing				  				resto = cint(numero_fotos) mod 6								IF resto = 0 then 				numero_paginas = (cint(numero_fotos) / 6) + 1				Else				numero_paginas = cint(numero_fotos) / 6				End If												  		  				  if isNumeric(request.querystring("pagina")) then					  pagina = request.querystring("pagina")				  else 					  pagina = 1				  end if				  				  pagina = cint(pagina)				  				  				  if pagina = "" or pagina > numero_paginas or pagina < 1 then					  inicio = 0				  else					inicio = ((pagina * 6) - 6)				  end if				   				  sqls = "SELECT * FROM cadastro WHERE foto_p <> '' AND foto_g <> '' limit "& inicio &", 9"				  				  set rs = conn.execute(sqls)				  				  for l = 1 to 2					  if not rsBusca.EOF then				  %>		 <tr>		   <%								for c = 1 to 3												if not rsBusca.EOF then							foto_pqna = "<img src='fotos_/"& rsBusca("foto_p") &"' width='41' height='41' border='0'>"						%>		   <td align="center" bgcolor="#ECE9D8" class="tdFotos"  ><a href="java script:;" onmousedown="MM_openBrWindow('fotos_/<%=rsBusca("foto_g")%>','','width=350,height=288')"><%=foto_pqna%></a></td>		   <%						end if						if not rsBusca.EOF then							rsBusca.movenext						end if						next						%>		 </tr>		 <%					  end if				  next				  %>		 <%end if%>		 <%end if%>		 </table>	 	<% if pagina > 1 then %>		  <a href="busca.asp?pagina=<%=(pagina - 1)%>" target="_self"><img src="back.gif" alt="Ir para a página anterior" width="42" height="13" border="0" /></a>		  <% end if %>		  <% if pagina < numero_paginas then %>				  <a href="busca.asp?pagina=<%=(pagina + 1)%>" target="_self"><img src="next.gif" alt="Ir para a próxima página" width="42" height="13" border="0" /></a>			  <% end if %>			  <%	  response.Write numero_paginas				  response.End()%>			  </td>   </tr>   <tr>   </tr> </table>	</td>  </tr></table></body></html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara sem querer ser xato...mas essa páginação sua tá meio maluca heim?!...você esta fazendo páginação é das FOTOS e nãos do SELECT que faz a busca.... ta meio cabuloso isso aí...

Compartilhar este post


Link para o post
Compartilhar em outros sites

O que fiz foi uma busca normal.So que quando ele for mostra o resultado ele me mostra as fotos que fiz um for que vai mostra 2 <tr> e 6 por td. e coloquei uma paginação ai caso a mais de 12 fotos.

Compartilhar este post


Link para o post
Compartilhar em outros sites

dei mais uma mudada no script mais nada

 

<%		 		 		 Call abre_conexao 			  				  sqls = "SELECT COUNT(*) as total FROM cadastro WHERE foto_p <> '' AND foto_g <> ''"				  set rs = conn.execute(sqls)					  numero_fotos = rs("total")				  				  set rs = nothing				  				  resto = cint(numero_fotos) mod 12				IF resto = 0 then 					numero_paginas = cint(numero_fotos) / 12 + 1				Else					numero_paginas = cint(numero_fotos) / 12				End If								numero_paginas = numero_paginas + 1 				  				  if isNumeric(request.querystring("pagina")) then					  pagina = request.querystring("pagina")				  else 					  pagina = 1				  end if				  				  pagina = cint(pagina)							  				  if pagina = "" or pagina > numero_paginas or pagina < 1 then					  inicio = 0				  else					inicio = (pagina + 12) 				  end if				  				  sqls = "SELECT * FROM cadastro WHERE foto_p <> '' AND foto_g <> '' limit "& inicio &", 12"				  				  set rs = conn.execute(sqls)				  				  for l = 1 to 2					  if not rs.EOF then				  %>		  <tr>			<%						for c = 1 to 6						if not rs.EOF then							foto_pqna = "<img src='fotos_/"& rs("foto_p") &"' width='41' height='41' border='0'>"						%>		   <td align="center" bgcolor="#ECE9D8" class="tdFotos"  ><a href="java script:;" onmousedown="MM_openBrWindow('fotos_/<%=rsBusca("foto_g")%>','','width=350,height=288')"><%=foto_pqna%></a></td>			<%						end if						if not rs.EOF then							rs.movenext						end if						next						%>		  </tr>		  <%					  end if				  next				  %>		 <%end if%>		 <%end if%>		 </table>	 	<% if pagina > 1 then %>		  <a href="busca.asp?pagina=<%=(pagina - 1)%>" target="_self"><img src="back.gif" alt="Ir para a página anterior" width="42" height="13" border="0" /></a>		  <% end if %>		  <% if pagina < numero_paginas then %>				  <a href="busca.asp?pagina=<%=(pagina + 1)%>" target="_self"><img src="next.gif" alt="Ir para a próxima página" width="42" height="13" border="0" /></a>			  <% end if %>

Compartilhar este post


Link para o post
Compartilhar em outros sites

galera.. depois de muito response.write heheh consegui arrumar o erro que tinha

 

mais agora minha #@?$%~ esta com pau quando mando busca ex: nome ela me volta com tudo que tem no banco e se busco mesmo alguma coisa que não tem ai fala que não foi encontrado

 

<%	if request.querystring("acao") = "busca" then			nome	  = Trim(Request.form ("nome"))		cabelo	= Trim(Request.Form("cabelo"))		idade	 = Trim(Request.Form("idade"))		tipo	  = Request.Form("tipo")		olhos	 = Request.Form("olhos")		sexo	  = Request.Form("sexo")		pele	  = Request.Form("pele")		profissao = Request.Form("profissao")		sFiltro = "WHERE "	If nome <> "" then	sFiltro = sFiltro & "nome Like '%" & nome & "%' and "end ifIf idade <> "" then	sFiltro = sFiltro & "idade Like '%" & idade & "%' and "end ifIf cabelo <> "" then	sFiltro = sFiltro & "cabelo Like '%" & cabelo & "%' and "end ifIf Tipo <> "" then	sFiltro = sFiltro & "Tipo Like '%" & Tipo & "%' and "end ifIf olhos <> "" then	sFiltro = sFiltro & "olhos Like '%" & olhos & "%' and "end ifIf profissao <> "" Then	sFiltro = sFiltro & "profissao Like '%" & profissao & "%' and "end ifIf pele <> "" then	sFiltro = sFiltro & " pele Like '%" & pele & "%' and "end ifIf sexo <> "" then	sFiltro = sFiltro & " sexo Like '%" & sexo & "%' and "end ifif sFiltro = "WHERE " then	sFiltro = ""else	SFiltro = left(sFiltro,len(sFiltro) - 4)End ifStrSQl = "SELECT * FROM `cadastro` "  & sFiltroCall abre_conexaoSet rsBusca = conn.Execute (StrSQl) 	%>	<table width="96%" height="90" border="0" cellpadding="0" cellspacing="1">   <tr>	 <td width="46%" height="14" valign="top"> </td>	 <td width="54%" valign="top"><% If rsBusca.EOF  then 		  response.write("<img src='nada.gif' width='116' height='16' />")		   Else%></td>   </tr>   <tr>	 <td height="36" colspan="2" valign="top">	 <table border="0" cellpadding="0" cellspacing="0" bgcolor="#ECE9D8">		 <%		 		 		 Call abre_conexao 			  				  sqls = "SELECT COUNT(*) as total FROM cadastro WHERE foto_p <> '' AND foto_g <> ''"				  set rs = conn.execute(sqls)					  numero_fotos = rs("total")				  				  set rs = nothing				  				  resto = cint(numero_fotos) mod 12				IF resto = 0 then 					numero_paginas = (cint(numero_fotos) / 12) +1				Else					numero_paginas = (cint(numero_fotos) / 12) 				End If											  				  if isNumeric(request.querystring("pagina")) then					  pagina = request.querystring("pagina")				  else 					  pagina = 1				  end if				  				  pagina = cint(pagina)							  				  if pagina = "" or pagina > numero_paginas or pagina < 1 then					  inicio = 0				  else					inicio = (pagina + 12) 				  end if				  				  sqls = "SELECT * FROM cadastro WHERE foto_p <> '' AND foto_g <> '' limit "& inicio &", 12"				  				  set rs = conn.execute(sqls)				  				  for l = 1 to 2					  if not rs.EOF then				  %>		  <tr>			<%						for c = 1 to 6						if not rs.EOF then							foto_pqna = "<img src='fotos_/"& rs("foto_p") &"' width='41' height='41' border='0'>"						%>		   <td align="center" bgcolor="#ECE9D8" class="tdFotos"  ><a href="java script:;" onmousedown="MM_openBrWindow('fotos_/<%=rsBusca("foto_g")%>','','width=350,height=288')"><%=foto_pqna%></a></td>			<%						end if						if not rs.EOF then							rs.movenext						end if						next						%>		  </tr>		  <%					  end if				  next				  %>		 <%end if%>		 <%end if%>		 </table>	 	<% if pagina > 0 then %>		  <a href="busca.asp?acao=busca&pagina=<%=(pagina - 1)%>" target="_self"><img src="back.gif" alt="Ir para a página anterior" width="42" height="13" border="0" /></a>		  <% end if %>		  <% if pagina < numero_paginas - 1 then %>			  <a href="busca.asp?acao=busca&pagina=<%=(pagina + 1)%>" target="_self"><img src="next.gif" alt="Ir para a próxima página" width="42" height="13" border="0" /></a>			  <% end if %>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.