Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/02/2009, 13:36
Avatar de JoseAlejandro_Realza
JoseAlejandro_Realza
 
Fecha de Ingreso: agosto-2008
Ubicación: Maracay - Venezuela
Mensajes: 192
Antigüedad: 15 años, 9 meses
Puntos: 2
Paginacion en php Ayuda

Hola Que Tal... Aca Tengo un script Php que lo consegui en php.com.ar, y le modifique unas cosas para que trabaje como quiero, y ahora no me genera bien los link siguientes y anterior... espero me me sepan ayudar

Aca Dejo el codigo PHP

Código PHP:
<?php
if (isset($_REQUEST['pos']))
  
$inicio=$_REQUEST['pos'];
else
  
$inicio=0;
?>
<html>
<head>
<title>Paginar Usuarios</title>
<style type="text/css">
<!--


.style7 {font-size: 14px}
.style8 {
    font-family: "Monotype Corsiva";
    font-size: 24px;
    color: #FF0000;
}
a:link {
    color: #FF0000;
}
a:hover {
    color: #FF9900;
}
a:active {
    color: #000000;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>

  <?php
$conexion
=mysql_connect("localhost","usuario","contraseña") or
  die(
"Problemas en la conexion");
mysql_select_db("enmaracay_usuarios",$conexion) or
  die(
"Problemas en la selección de la base de datos");
$registros=mysql_query("select nick,nombre,email,pais,avatar from usuarios 
                       limit $inicio,2"
$conexion) or
  die(
"Problemas en el select:".mysql_error());
$datos = array();
while(
$row=mysql_fetch_array($registros)) 
    
$datos[] = $row;

$impresos=0;




mysql_close($conexion);

if (
$inicio==0)
  echo 
"anteriores ";
else
{
  
$anterior=$inicio-2;
  echo 
"<a href=\Paginar_Usuarios.php?pos=$anterior\">Anteriores </a>";
}
if (
$impresos==2)
{
  
$proximo=$inicio+2;
  echo 
"<a href=\"Paginar_Usuarios.php?pos=$proximo\">Siguientes</a>";
}
else
  echo 
"siguientes";
?>

  <?php
 
foreach($datos as $dato) {
// Aqui muestras los datos
    
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" height=\"200\">
  <!-- MSTableType=\"layout\" -->
  <tr>
    <td width=\"386\" valign=\"top\" background=\"images/123.png\"><!-- MSCellType=\"ContentBody\" -->
      &nbsp;
      <p class=\"style7\">Nombre: {$dato['nombre']} </p>
      <p class=\"style7\">Pais: {$dato['pais']}</p>
      <p class=\"style7\">Ciudad: {$dato['ciudad']}y</p>
      <p class=\"style8\"><a href=\"#\">Ver Perfil </a></p></td>
    <td width=\"114\" height=\"200\" valign=\"top\" background=\"images/112.png\"><!-- MSCellType=\"NavBody2\" --><img src=\"{$dato['avatar']}\" width=\"110\" height=\"116\"></td>
  </tr>
</table>"
;
}


?>
  <p>&nbsp; </p>
</body>
</html>
__________________
Tu Guía Empresarial http://www.empresarial.org.ve Soluciones Empresariales

Atte: José Alejandro Realza