Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/09/2012, 05:45
carlosuc99
 
Fecha de Ingreso: junio-2011
Mensajes: 342
Antigüedad: 15 años, 3 meses
Puntos: 5
Exclamación Fallo en paginación

Buenas,

Tengo el siguiente archivo PHP paginado:

Código PHP:
<?
require('../libreria.php');
$user =& JFactory::getUser();
$usuario = $user->username;

$pag = $_REQUEST['p'];
if( !isset(
$pag) ) $pag = 0;
$sig = $pag + 1;
$ant = 0;
if(
$pag > 0) $ant = $pag - 1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ver Rutas</title>
</head>
<body>
<?

mysql_connect
('', '', '') or die('Ha habido un problema con la conexi&oacute;n al servidor.');
mysql_select_db('') or die('Ha habido un problema con la conexi&oacute;n a la base de datos.');
$res = mysql_query("SELECT * FROM flights ORDER BY flightnumber, acft LIMIT $pag, 20");
$filas = mysql_num_rows($res);

if(
$filas > 0)
{
    
?>
    <table cellpadding="2" cellspacing="0" style="text-align: center; width: 100%;">
    <tr style="background-color: #D2232A; font-weight: bold; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: white; text-align: center;"><td></td><td>Num. Vuelo</td><td>Modelo</td><td>Salida</td><td>Llegada</td><td>Altitud</td><td>EET</td><td>Precio</td><td>Disponible</td>
    <?
    
if($usuario == 'HTH1001' || $usuario == 'HTH1002') echo '<td>Gesti&oacute;n</td>';
    
?>
    </tr>
    <?
    
    
for($i = 0; $i < $filas; $i++)
    {
        
$id = mysql_result($res, $i, 'flightnumber');
        
$icao = mysql_result($res, $i, 'acft');
        
$sal = mysql_result($res, $i, 'departure');
        
$lleg = mysql_result($res, $i, 'destination');
        
$altitud = mysql_result($res, $i, 'altitude');
        
$precio = mysql_result($res, $i, 'precio');
        
$codigo = '<img src="http://helittva.com/albrep/images/yes.png" alt="si" />';
        
$res3 = mysql_query("SELECT aeronave FROM reservas WHERE ruta = '$id'");
        for(
$j = 0; $j < mysql_num_rows($res3); $j++)
        {
            
$mat = mysql_result($res3, $j);
            
$res4 = mysql_query("SELECT icao FROM aeronaves WHERE matricula = '$mat'");
            
$icaores = mysql_result($res4, 0);
            if(
$icaores == $icao) $codigo = '<img src="http://helittva.com/albrep/images/no.png" alt="no" />';
        }
        
$eet = mysql_result($res, $i, 'eet');
        
$color = $i % 2 == 0 ? $color = 'white' : '#CCC';
        
        echo 
"<tr style=\"text-align: center; font-size: 10px; font-family: Arial, Helvetica, sans-serif; background-color: $color;\"><td><img src='http://helittva.com/albrep/images/vuelo.gif'></td><td>$id</td><td>$icao</td><td>$sal</td><td>$lleg</td><td>$altitud ft</td><td>$eet</td><td>$precio &euro;</td><td>$codigo</td>";
        if(
$usuario == '' || $usuario == '') echo "<td><a title=\"Editar\" href=\"editar-ruta.php?ruta=$id\"><img src=\"http://helittva.com/albrep/images/info.png\" onmouseover=\"javascript: this.src = 'http://helittva.com/albrep/images/info.png'\" onmouseout=\"javascript: this.src = 'http://helittva.com/albrep/images/info.png'\" alt=\"modif\" /></a><a title=\"Eliminar\" href=\"eliminar-ruta.php?ruta=$id&acft=$icao\"><img src=\"http://helittva.com/albrep/images/cross.png\" onmouseover=\"javascript: this.src = 'http://helittva.com/albrep/images/cross.png'\" onmouseout=\"javascript: this.src = 'http://helittva.com/albrep/images/cross.png'\" alt=\"alim\" /></a></td>";
        echo 
"</tr>\n";
    }
    echo 
'</table>';
    if (
$filas > 19)
    {
        echo 
"<br>";
        echo 
"<center>";
        echo 
"<a style=\"color: #D2232A;\" href=\"ver-rutas.php?p=$ant\">Anterior</a> <a style=\"color: #D2232A;\" href=\"ver-rutas.php?p=$sig\">Siguiente</a>";
        echo 
"</center>";
    }
    
}
else echo 
'<h4 style="color: red;">No hay vuelos disponibles.</h4>';
mysql_close();
?>

<?

?>
</body>
</html>
El problema es que cuando quiero pasar de página me muestra los mismos resultados de la página anterior menos uno.

Yo lo que quiero es que al pasar la página se vean resultados diferentes a los anteriores y no los mismos quitando uno anterior.