Tema: Paginador
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/01/2011, 17:56
h3greed
 
Fecha de Ingreso: septiembre-2008
Mensajes: 67
Antigüedad: 15 años, 7 meses
Puntos: 0
Pregunta Respuesta: Paginador

Gracias por responder,

La verdad es que no encuentro el error te dejo mi codigo donde se recibe la informacion por post desde el formulario de consulta, que despues me cancela la operacion cuando paso a la segunda pagina a ver si me podes ayudar mejor, gracias

Código PHP:
<? include ("login/dbconexion.php");    

$tipo $_POST ['tipo']; 
$amb $_POST ['amb']; 
$localidad $_POST ['localidad']; 
$barrio $_POST ['barrio']; 
$tprop $_POST ['tprop']; 
$precio $_POST ['precio']; 

  
$RegistrosAMostrar=2
  if(isset(
$_GET['pag'])){ 
    
$RegistrosAEmpezar=($_GET['pag']-1)*$RegistrosAMostrar
    
$PagAct=$_GET['pag']; 
//caso contrario los iniciamos 
}else{ 
    
$RegistrosAEmpezar=0
    
$PagAct=1
     


$query "SELECT * FROM propiedades"
$conditions = array(); 

if( 
$tipo != "0" ) { 
      
$conditions[] = "tipo = '$tipo'"

if( 
$amb != "0" ) { 
      
$conditions[] = "amb = '$amb'"

if( 
$localidad != "0" ) { 
      
$conditions[] = "localidad = '$localidad'"

if( 
$barrio != "0" ) { 
      
$conditions[] = "barrio = '$barrio'"

if( 
$tprop != "0" ) { 
      
$conditions[''] = "tprop = '$tprop'"




if( 
count$conditions[''] ) > ) { 
$query .= " WHERE " implode " AND "$conditions) ; // = SELECT * FROM propiedades WHERE pais = 'españa' AND localidad = 'galicia' AND etc 


//$result=mysql_query("select * from propiedades ORDER BY codigo LIMIT $RegistrosAEmpezar, $RegistrosAMostrar",$con); 
  
$sql mysql_query($query ."ORDER BY codigo LIMIT $RegistrosAEmpezar, $RegistrosAMostrar",$con);  

echo 
$query."<br><br><br>"
echo 
"Su búsqueda fue:<br>"
echo 
"<br>".$tprop."&nbsp;en&nbsp;".$tipo."&nbsp;".$amb."&nbsp;ambientes&nbsp;".$barrio."&nbsp;".$localidad;  
echo 
"<br>"
echo 
"<br>Precio".$precio."<br>"
//while($row=mysql_fetch_array($result)) 
  
while($row=mysql_fetch_array($sql)){  
    echo 
"<tr>"
    echo 
"<td height='10' align='right' valign='top'><strong></strong></td>"
    echo 
"</tr>"
    echo 
"<tr>"
    echo 
"<td width='417' height='272' align='left' valign='top'>"
    echo 
"<table width='415' border='0'>"
    echo 
"<tr>"
    echo 
"<td width='409' height='23'>"
    echo 
"<table width='462' border='0' align='left'>"
    echo 
"<tr valign='top'>"
    echo 
"<td height='29' align='right'>&nbsp;</td>"
    echo 
"<td align='right'><strong>Codigo de propiedad&nbsp;</strong>" .$row['codigo']."</td>"
    echo 
"</tr>"
    echo 
"<tr>"
    echo 
"<td width='276'>".$row['titulo']."<br></strong></td>"
    echo 
"<td width='176'>".$row['estado']."</td>"
    echo 
"</tr>"
    echo 
"</table></td>"
    echo 
"</tr>"
    echo 
"<tr>"
    echo 
"<td height='225' align='left' valign='top'><table width='418' border='0'>"
    echo 
"<tr>"
    echo 
"<td width='212' height='165' align='left' valign='top'><table width='156' border='0'>"
    echo 
"<tr>"
    echo 
"<td width='150' height='56'>"
    echo 
"<table width='203' border='0'>"
    echo 
"<tr>"
    echo 
"<td width='197'>"
    echo 
"<p><img src='".$row['foto1']."' width='160' height='120'/></p>";     
    echo 
"</td>"
    echo 
"</tr>"
    echo 
"<tr>"
    echo 
"<td height='24'>&nbsp;</td>"
    echo 
"</tr>"
    echo 
"</table>"
    echo 
"</td>"
    echo 
"</tr>"
    echo 
"<tr>"
    echo 
"</td>"
    echo 
"</tr>"
    echo 
"</table></td>"
    echo 
"<td width='196' align='left' valign='top'>"
    echo 
"<p><br>"
    echo 
"<strong>Direccion:</strong><br>".$row['direct']."<br>".$row['barrio']."&nbsp;".$row['localidad']."<br>"
    echo 
"<strong>Tipo:</strong>&nbsp;".$row['tprop']."<br>"
    echo 
"<strong>Ambientes:</strong>&nbsp;".$row['amb']."<br>"
    echo 
"<strong>Metros totales:</strong>&nbsp;".$row['m2t']."<br>"
    echo 
"<strong>Antiguedad:</strong>&nbsp;".$row['ant']."&nbsp;anos<br>"
    echo 
"</p>"
    echo 
"<table width='223' border='0' align='right'>"
    echo 
"<tr>"
    echo 
"<td width='48'>&nbsp;</td>"
    echo 
"<td width='165'><strong>Precio&nbsp;".$row['to'].":</strong>&nbsp;&nbsp;".$row['precio']."</td>"
    echo 
"</tr>"
    echo 
"<tr>"
    echo 
"<td height='74'>&nbsp;</td>"
    echo 
"<td><a href='detalle.php?codigo=".$row['codigo']."'>Ver mas</a></td>"
    echo 
"</tr>"
    echo 
"</table>"
    echo 
"</td>"
    echo 
"</tr>"
    echo 
"</table></td>"
    echo 
"</tr>";     
    echo 
"</table>"
    echo 
"<p>"
    echo 
"</p>"
    echo 
"<p>&nbsp;</p>"
    echo 
"<p><br>"
    echo 
"</p></td>"
    echo 
"</tr>"

    echo 
"</table>"
//cerramos el conjunto de resultado y la conexión con la base de datos  

                            //   $sql = mysql_query($query ."ORDER BY codigo LIMIT $RegistrosAEmpezar, $RegistrosAMostrar",$con);  

$NroRegistrosmysql_num_rows (mysql_query($query .'ORDER BY codigo',$con)); 
$PagAnt=$PagAct-1
$PagSig=$PagAct+1
$PagUlt=$NroRegistros/$RegistrosAMostrar
$Res=$NroRegistros%$RegistrosAMostrar
if(
$Res>0$PagUlt=floor($PagUlt)+1
echo 
"<a onclick=\"Pagina('1')\">Primero</a> "
if(
$PagAct>1) echo "<a onclick=\"Pagina('$PagAnt')\">Anterior</a> "
echo 
"<strong>Pagina ".$PagAct."/".$PagUlt."</strong>"
if(
$PagAct<$PagUlt)  echo " <a onclick=\"Pagina('$PagSig')\">Siguiente</a> "
echo 
"<a onclick=\"Pagina('$PagUlt')\">Ultimo</a>"
?>