Foros del Web » Programando para Internet » PHP »

Paginar registros ...indices php mysql

Estas en el tema de Paginar registros ...indices php mysql en el foro de PHP en Foros del Web. QUE TAL AMIGOS...ESTOY TRATANDO DE PAGINAR LOS RESULTADOS DE REGISTROS DE LABASE DE DATOS...... ME EXPLICO, QUIERO QUE APARESCAN LOS 5 PRIMEROS REGISTROS EN LA ...
  #1 (permalink)  
Antiguo 16/02/2011, 23:08
 
Fecha de Ingreso: noviembre-2010
Mensajes: 208
Antigüedad: 13 años, 3 meses
Puntos: 3
Paginar registros ...indices php mysql

QUE TAL AMIGOS...ESTOY TRATANDO DE PAGINAR LOS RESULTADOS DE REGISTROS DE LABASE DE DATOS......

ME EXPLICO, QUIERO QUE APARESCAN LOS 5 PRIMEROS REGISTROS EN LA PAG, DE 5 EN 5.......Y QUE ME APARESCAN LOS NUMEROS DE LAS PAGINAS ABAJO...INDICES PARA MOVER DE PAGINA E PAGINA Y PODER VER EL RESTO DE LOS REGISTROS...

MI CODIGO MUESTRA LOS 5 PRIMEROS REGISTROS...PERO CUANDO PRESIONO EN LA PAG 2 NO ME MUESTRA EL RESTO DE LOS REGISTROS......

WENO AKA LES DEJO EL CODIG


listar_cli.php


<?php
include("conectar.php");
$result_clientes=mysql_query('SELECT *FROM clientes ORDER BY nombre_cliente');
$num_registros=mysql_num_rows($result_clientes);

if($num_registros==0)
{
echo "No existen registros de Clientes";

exit();
}

$registros=5;
$pagina=$_GET["num"];

if(is_numeric($pagina))

$inicio=(($pagina-1)*registros);

else

$inicio=0;

$result_clientes=mysql_query('SELECT *FROM clientes ORDER BY nombre_cliente LIMIT 0,5');

$paginas=ceil($num_registros/$registros);
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Einlab-Clientes</title>
<style type="text/css">
<!--
.Estilo2 {color: #FFFFFF}
.Estilo3 {color: #333333}
-->
</style></head>

<body>

<h3 align="center"> Listado Clientes</h3>
<table width="950" border="0" align="center" bgcolor="#0066FF">
<tr>
<th width="113" bordercolor="#FFFFFF" scope="col"><span class="Estilo2">ID</span></th>
<th width="287" bordercolor="#FFFFFF" scope="col"><span class="Estilo2">Rut</span></th>
<th width="536" bordercolor="#FFFFFF" scope="col"><span class="Estilo2">Nombre</span></th>
<th width="536" bordercolor="#FFFFFF" scope="col"><span class="Estilo2">Apellido</span></th>
<th width="536" bordercolor="#FFFFFF" scope="col"><span class="Estilo2">Modificar</span></th>
</tr>
<?php

while($fila=mysql_fetch_array($result_clientes))
{

?>

<tr>

<td bgcolor="#FFFFFF"><span class="Estilo3"><?php echo $fila[0];?></span></td>
<td bgcolor="#FFFFFF"><span class="Estilo3"><?php echo $fila["rut_cliente"];?></span></td>
<td bgcolor="#FFFFFF"><span class="Estilo3"><?php echo $fila["nombre_cliente"];?></td>
<td bgcolor="#FFFFFF"><span class="Estilo3"><?php echo $fila["apellidop_cliente"];?></td>
<td bgcolor="#FFFFFF"><span class="Estilo3">&nbsp;</td>
</tr>

<?php
}
?>
</table>

<div align="center">
<?php

for($cont=1;$cont<=$paginas;$cont++)
{
echo "<a href='listar_cli.php?num=". $cont."'>.$cont</a> ";
}

?>
</div>
<p align="center">&nbsp; </p>

</body>
</html>
  #2 (permalink)  
Antiguo 17/02/2011, 00:03
marcofbb
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Paginar registros ...indices php mysql

Aca tenes un script que hace gusto lo que buscas.

http://www.desarrolloweb.com/articulos/1733.php

Etiquetas: indices, mysql, paginar, registros
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:52.