Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/05/2013, 10:14
Avatar de T4ke0veR
T4ke0veR
 
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 19 años, 1 mes
Puntos: 28
Pregunta Paginación no funciona

Saludos,
Me encuentro haciendo un sistema en donde me pagina 7 imagenes horizontal y un total de 21 por pagina, pero me pasa que no me muestra el boton de siguiente, solo el boton de ultimo y si me paso a ultimo me muestra el de anterior y primero sin problema alguno... No doy con la falla, si alguien pudiera ayudarme

Datos de paginacion y consulta
Código PHP:
// Variables de Configuración -----------------------------------
// Define el numero de Filas
$n_filas=7;

//***************************************************************
@$cat=$_REQUEST['id'];
$maxRows = 21;
$pageNum = 0;

if (isset(
$_GET['pageNum'])) {

  
$pageNum = $_GET['pageNum'];

}

$startRow = $pageNum * $maxRows;
//$cat=6;

$fotos = array();
mysql_select_db($database_azimut, $azimut);

$sql = "SELECT * FROM clipping ORDER BY id DESC";

$query_limit = sprintf("%s LIMIT %d, %d", $sql, $startRow, $maxRows);

$Recordset = mysql_query($query_limit, $azimut) or die(mysql_error());

    
    
/*while($row=mysql_fetch_assoc($sql_exec)){
            $tottal=mysql_affected_rows(); // Calculo el numero total de itms a listar
            }*/
$tottal=113;
// ------------------------------------------------------------------------------------------------------------------


if (isset($_GET['totalRows'])) {

  
$totalRows = $_GET['totalRows'];

} else {

  
$all = mysql_query($sql);

  
$totalRows = mysql_num_rows($all);

}

$totalPages = ceil($totalRows/$maxRows)-1;







$queryString = "";

if (!empty(
$_SERVER['QUERY_STRING'])) {

  
$params = explode("&", $_SERVER['QUERY_STRING']);

  
$newParams = array();

  foreach (
$params as $param) {

    if (
stristr($param, "pageNum") == false && 

        
stristr($param, "totalRows") == false) {

      
array_push($newParams, $param);

    }

  }

  if (
count($newParams) != 0) {

    
$queryString = "&" . htmlentities(implode("&", $newParams));

  }

}

$queryString = sprintf("&totalRows=%d%s", $totalRows, $queryString);
$vert=$tottal/$n_filas;
$vert=round($vert); 
Botones para paginación
Código PHP:
<?php if ($pageNum > 0) { // Show if not first page ?>
      <a href="<?php printf("%s?pageNum=%d%s", $currentPage, 0, $queryString); ?>">Primero</a>
      <?php } // Show if not first page ?></td>
    <td width="31%" align="center"><?php if ($pageNum > 0) { // Show if not first page ?>
      <a href="<?php printf("%s?pageNum=%d%s", $currentPage, max(0, $pageNum - 1), $queryString); ?>">Anterior</a>
      <?php } // Show if not first page ?></td>
    <td width="23%" align="center"><?php if ($pageNum < $totalPages1) { // Show if not last page ?>
      <a href="<?php printf("%s?pageNum=%d%s", $currentPage, min($totalPages, $pageNum + 1), $queryString); ?>">Siguiente</a>
      <?php } // Show if not last page ?></td>
    <td width="23%" align="center"><?php if ($pageNum < $totalPages) { // Show if not last page ?>
      <a href="<?php printf("%s?pageNum=%d%s", $currentPage, $totalPages, $queryString); ?>">&Uacute;ltimo</a>
      <?php } // Show if not last page ?>
Gracias de antemano
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...