Ver Mensaje Individual
  #4 (permalink)  
Antiguo 27/02/2013, 21:39
Avatar de zetahosting
zetahosting
 
Fecha de Ingreso: octubre-2011
Mensajes: 119
Antigüedad: 12 años, 6 meses
Puntos: 2
Respuesta: Como Hacer links de paginación

porque no probas asi amigo:

Cita:
<?php

require('connect_db.php');

// maximo por pagina
$limit = 10;

// pagina pedida
$pag = (int) $_GET["pag"];
if ($pag < 1)
{
$pag = 1;
}
$offset = ($pag-1) * $limit;
$pag2=$pag+10;

$sql = "SELECT SQL_CALC_FOUND_ROWS id ,Nick ,Sexo ,FechaNac,DiaRegistro ,avatar FROM registro LIMIT $offset, $limit";
$sqlTotal = "SELECT FOUND_ROWS() as total";

$rs = mysql_query($sql);
$rsTotal = mysql_query($sqlTotal);

$num_rows=mysql_num_rows($rs);


$rowTotal = mysql_fetch_assoc($rsTotal);
// Total de registros sin limit
$total = $rowTotal["total"];

while ($row = mysql_fetch_assoc($rs))
{


$id = $row["id"];
$Nick = $row["Nick"];
$Sexo = $row["Sexo"];
$Fecha = $row["FechaNac"];
$Registro = $row["DiaRegistro"];
$avatar = $row["avatar"];
?>
<p></p>

<td align ="center" Height="30" Width="150" background="http://i46.tinypic.com/qsur9t.jpg"><font color="red"><label for="foro">Usuario</label></font></td> <td align ="center" Height="30" Width="110" background="ImagenInicio/fondotabla3.jpg"></td> <td align ="center" Height="30" Width="240" background="ImagenInicio/fondotabla3.jpg"></td> <td align ="center" Height="30" Width="400" background="ImagenInicio/fondotabla3.jpg"></td> </tr>

<tr>
<td align ="center" Height="110" Width="160" background="ImagenInicio/fondo.jpg" ><br><img src= <?php echo "miembros/$avatar" ?> width="110" height="130" /></br><br></br>Nick : <a href="perfil.php?id= <?php echo $id ?>"><font color="red"><?php echo $Nick ?></a></font><br></br></td>
<td align ="left" Height="110" Width="160" background="ImagenInicio/fondo.jpg"><br><?php echo "***" ?>Sexo :</br><br><?php echo "***" ?>Fecha de Nacimiento :</br><br><?php echo "***" ?>Se registro el :</br></td>
<td align ="left" Height="30" Width="140" background="ImagenInicio/fondo.jpg"><br><?php echo "***" ?> <?php echo $Sexo ?></br><br><?php echo "***" ?><?php echo $Fecha ?></br><br><?php echo "***" ?><?php echo $Registro ?></br></td>
<td align ="center" Height="30" Width="390" background="ImagenInicio/fondo.jpg"></td> </tr>


</tr>



<?php
}


?>
</table>


<script type="text/javascript">
//Redireccionar con el formulario creado
document.formulario.submit();
</script>




<p>**</p>
<p>**</p>
</form>
</body>


<table border="0" Height="30" width="1400" cellpadding="0" cellspacing="0" align ="center">
<tr>
<td align="center" background="http://i46.tinypic.com/qsur9t.jpg"><font color=red >



<?php



$totalPag = ceil($total/$limit);
$links = array();
for( $i=1; $i<$pag2 ; $i++)
{
$links[] = "<li><a href=\"?pag=$i\">$i</a></li>";
}


echo implode(" - ", $links);

?>
<li class="next"><a href="?page=8">Next »</a></li>
</ul>

</font>
</td>
</tr>
</table>
__________________
Excelente WebHosting -> www.zetahosting.net
[email protected]
Twitter: @zetahosting