Tema: PHP y MYSQL
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/01/2014, 09:12
tayran8
 
Fecha de Ingreso: enero-2014
Ubicación: USA
Mensajes: 50
Antigüedad: 10 años, 4 meses
Puntos: 0
PHP y MYSQL

Estoy tratando de paginar los resultados de una consulta de mysql en php. La pagina muestra, limita y crea el link solo a la primera pagina y no a las restantes. No me aparece ningun tipo de error. Adjunto el código.



Gracias por la colaboracion!


Código PHP:
<?php

$registros
=4;
$pagina=$_GET["num"];
if (
is_numeric($pagina))
$inicio=(($pagina-1)*$registros);
else 
$inicio=0;
$busqueda=$con->query("SELECT * FROM clientes C INNER JOIN producto P ON C.serial  = P.serial ORDER BY estado LIMIT $inicio,$registros"); {
    
$num_registros $busqueda->num_rows;
}

$paginas ceil ($num_registros/$registros);

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

}


echo 
"<table border=1>
<tr>
<th>Cliente</th>
<th>Cedula</th>
<th>Orden numero</th>
<th>Email</th>
<th>Barrio</th>
<th>Telefono</th>
<th>Producto</th>
<th>Marca</th>
<th>Almacen</th>
<th>Dano</th>
<th>Fecha de recepcion</th>
<th>Tecnico</th>
<th>Estado</th>
<th>Sede</th>
<th>Fecha de entrega</th>
</tr>"
;
$rowColors = Array('#A6A6FF','#FFFFFF'); $nRow 0;
while (
$muestra=$busqueda->fetch_array()){
echo 
'<tr style="background-color:'.$rowColors[$nRow++ % count($rowColors)].';">';

echo 
'<td>' .$muestra['cliente'].'</td>';
echo 
'<td>' .$muestra['cedula']. '</td>';
echo 
'<td>' .$muestra['serial']. '</td>';
echo 
'<td>' .$muestra['email']. '</td>';
echo 
'<td>' .$muestra['barrio'].'</td>';
echo 
'<td>' .$muestra['telefono']. '</td>';
echo 
'<td>' .$muestra['producto']. '</td>';
echo 
'<td>' .$muestra['marca']. '</td>';
echo 
'<td>' .$muestra['almacen']. '</td>';
echo 
'<td>' .$muestra['dano'].'</td>';
echo 
'<td>' .$muestra['fecharecepcion']. '</td>';
echo 
'<td>' .$muestra['tecnico']. '</td>';
echo 
'<td>' .$muestra['estado']. '</td>';
echo 
'<td>' .$muestra['sede']. '</td>';
echo 
'<td>' .$muestra['entregaacliente']. '</td>';


}

mysqli_close ($con)

?>
  
  
  
</body>
</html>