De antemano les dire que ya instale el PEAR y esta funcionando mi Pager, bueno de cierta forma funciona mi codigo de paginación
![Serio](http://static.forosdelweb.com/fdwtheme/images/smilies/molesto.png)
Cuando ejecuto mi codigo mi tabla aparece vacia y mis link abajo...luego al pasar a la siguiente pagina [2] ya aparecen los primeros 10 datos de mi tabla... al pasar a la siguiente pagina [3] aparecen los otros 10 datos, pero debajo de los 10 anteriores; es decir aparecen 20 registros en la tabla, y esto es incorrecto pues los resultados se deben mostrar de 10 en 10 segun vaya navegando por los link espero haberme explicado bien aqui esta el codigo que estoy utilizando
Código PHP:
<?php
require_once ( 'Pager/Pager.php' ) ;
include('conexion.php');
/* First we need to get the total rows in the table */
$res=pg_exec($DB,"SELECT count(*) AS total FROM detalle_operacion");
$row = pg_fetch_array($res);
/* Total number of rows in the logs table */
$totalItems = $row['total'];
/* Set some options for the Pager */
$pager_options = array(
'mode' => 'Sliding', // Sliding or Jumping mode. See below.
'perPage' => 10, // Total rows to show per page
'delta' => 4, // See below
'spacesBeforeSeparator' => 1,
'nextImg' => "<img src='../../images/action_2rightarrow.png' width='30' height='30' border='0' align='absmiddle' />",
'prevImg' => "<img src='../../images/action_2leftarrow.png' width='30' height='30' border='0' align='absmiddle' />",
'totalItems' => $totalItems,
);
/* Initialize the Pager class with the above options */
$pager = Pager::factory($pager_options);
/* The following code will retreive the result using the pager options */
/* The function below will get the page offsets to be used with
the database query. For e.g if we are on the third page then the
$from variable will have the value of '21' (we are showing 10 items per
page, remember) and the $to variable will have the value of '30'.
*/
list($from, $to) = $pager->getOffsetByPageId();
/* The MySQL 'LIMIT' clause index starts from '0',
so decrease the $from by 1 */
$from = $from - 1;
/* The number of rows to get per query */
$perPage = $pager_options['perPage'];
$result = pg_exec($DB,"SELECT opr.descripcion_operacion, det.hora_detalle, det.fecha_detalle, det.descripcion_detalle
FROM Usuario AS usr, Detalle_Operacion AS det, Operacion AS opr
WHERE opr.codigo_operacion = det.codigo_operacion
AND usr.codigo_usuario = det.codigo_usuario LIMIT $from OFFSET $perPage");
echo"
<html>
<head>
<title> :: Bitacora Resultado:: </title>
<link rel='shortcut icon' href='../../images/favicon.ico'>
<link href='../../styles/style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<table width='700' border='1' cellpadding='3' cellspacing='1' align='center'>
<tr>
<td class='navbar'><strong>Descripción de la Operación</strong></td>
<td class='navbar'><strong>Hora de Operación</strong></td>
<td class='navbar'><strong>Fecha de Operación</strong></td>
<td class='navbar'><strong>Detalle de Operación</strong></td>
</tr>
";
while($data = pg_fetch_array($result)){
echo"
<tr>
<td>$data[descripcion_operacion]</td>
<td>$data[hora_detalle]</td>
<td>$data[fecha_detalle]</td>
<td>$data[descripcion_detalle]</td>
</tr>";
}
echo"
<table border='1' cellpadding='3' cellspacing='1' align='center'>
<tr>
<td>$pager->links<td>
</tr>
</table>
</table>
</body>
</html>";
?>