paginador
Publicado por zendi (1058 intervenciones) el 22/09/2010 21:43:12
he creado un script para listar unos registros pero me falta agregarle un paginador ya que cada vez que agrego un registro el SCROLL aumenta. Si alguien me puede ayudar le agrdezco Saludos Este el código:
<?php
$connect = pg_connect("host=localhost port=5432 dbname=administracion user=postgres password=bochi");
echo "Está usando:" ,$_SERVER['HTTP_USER_AGENT'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gastos</title>
<style type="text/css">
.sr {
background-color: #FFFFCF;
color: #000000;
font-family: Arial;
font-size: 12px;
}
input.color1 {background-color: #00CC99; font-weight: bold; font-size: 12px; color: white;}
</style>
</head>
<body>
<?php
$hoy=date('d-m-Y');
?>
<form action="ingresagastos.php" method="POST">
<fieldset style='width:auto'><LEGEND>Gastos</LEGEND>
<table align='center'>
<tr>
<td class="sr" align='right' style="text-decoration:none">Descripción:</td>
<td class="sr"><input type="text" name="descripcion" size="50" maxlength="50" align="right"/></td>
</tr>
<tr>
<td class="sr" align='right' style="text-decoration:none">Monto:</td>
<td class="sr"><input type="text" name="monto" size="5" maxlength="5" align="right"/></td>
</tr>
<tr>
<td class="sr" align='right' style="text-decoration:none">Fecha:</td>
<td class="sr"><input type="text" value="<?php echo $hoy;?>" readonly=".F." name="fecha" size="10" maxlength="10" align="right"/></td>
</tr>
</table>
<table align="center">
<tr>
<td>
<input class="color1" type="submit" name="action" value="Guardar">
<input class="color1" type="reset" value="Deshacer">
</td>
</tr>
</table>
</fieldset>
<br/>
<?php
$todosgastos = "SELECT * FROM gastos ORDER BY descripcion";
$seleccionados = @pg_query($connect,$todosgastos);
$total = 0;
while($select2 = @pg_fetch_array($seleccionados)):
$articulo = $select2['codigo'];
$descripcion = $select2['descripcion'];
$monto = $select2['monto'];
echo"<table align='center' border='1' bordercolor='#FFCC99'>
<tr class='sr'>
<td><a href='modificar.php?art=$articulo'>$articulo
<td width='200'>$descripcion
<td width='50' align='right'>$monto
</tr></table>";
$total +=$monto;
$ntotal = number_format($total,2,',','.');
endwhile;
$dtotal = "SELECT COUNT(*) AS tot FROM gastos";
$totgas = @pg_query($connect,$dtotal);
while($select1 = @pg_fetch_array($totgas)):
$gasto = $select1['tot'];
echo"<table align='center' border='1' bordercolor='#FFCC99'>
<tr class='sr'>
<td width='150' style='color:#000000'>Total Gastos
<td width='150' align='right'>$gasto
</tr></table>";
endwhile;
echo "<br><table align='center' border='1' bordercolor='#FFCC99' bgcolor='#99CC00'>
<tr class='sr'>
<td width='150' style='color:#000000'>Total
<td width='150' align='right'>$ntotal
</tr></table>";
?>
</form>
</body>
</html>
<?php
$connect = pg_connect("host=localhost port=5432 dbname=administracion user=postgres password=bochi");
echo "Está usando:" ,$_SERVER['HTTP_USER_AGENT'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gastos</title>
<style type="text/css">
.sr {
background-color: #FFFFCF;
color: #000000;
font-family: Arial;
font-size: 12px;
}
input.color1 {background-color: #00CC99; font-weight: bold; font-size: 12px; color: white;}
</style>
</head>
<body>
<?php
$hoy=date('d-m-Y');
?>
<form action="ingresagastos.php" method="POST">
<fieldset style='width:auto'><LEGEND>Gastos</LEGEND>
<table align='center'>
<tr>
<td class="sr" align='right' style="text-decoration:none">Descripción:</td>
<td class="sr"><input type="text" name="descripcion" size="50" maxlength="50" align="right"/></td>
</tr>
<tr>
<td class="sr" align='right' style="text-decoration:none">Monto:</td>
<td class="sr"><input type="text" name="monto" size="5" maxlength="5" align="right"/></td>
</tr>
<tr>
<td class="sr" align='right' style="text-decoration:none">Fecha:</td>
<td class="sr"><input type="text" value="<?php echo $hoy;?>" readonly=".F." name="fecha" size="10" maxlength="10" align="right"/></td>
</tr>
</table>
<table align="center">
<tr>
<td>
<input class="color1" type="submit" name="action" value="Guardar">
<input class="color1" type="reset" value="Deshacer">
</td>
</tr>
</table>
</fieldset>
<br/>
<?php
$todosgastos = "SELECT * FROM gastos ORDER BY descripcion";
$seleccionados = @pg_query($connect,$todosgastos);
$total = 0;
while($select2 = @pg_fetch_array($seleccionados)):
$articulo = $select2['codigo'];
$descripcion = $select2['descripcion'];
$monto = $select2['monto'];
echo"<table align='center' border='1' bordercolor='#FFCC99'>
<tr class='sr'>
<td><a href='modificar.php?art=$articulo'>$articulo
<td width='200'>$descripcion
<td width='50' align='right'>$monto
</tr></table>";
$total +=$monto;
$ntotal = number_format($total,2,',','.');
endwhile;
$dtotal = "SELECT COUNT(*) AS tot FROM gastos";
$totgas = @pg_query($connect,$dtotal);
while($select1 = @pg_fetch_array($totgas)):
$gasto = $select1['tot'];
echo"<table align='center' border='1' bordercolor='#FFCC99'>
<tr class='sr'>
<td width='150' style='color:#000000'>Total Gastos
<td width='150' align='right'>$gasto
</tr></table>";
endwhile;
echo "<br><table align='center' border='1' bordercolor='#FFCC99' bgcolor='#99CC00'>
<tr class='sr'>
<td width='150' style='color:#000000'>Total
<td width='150' align='right'>$ntotal
</tr></table>";
?>
</form>
</body>
</html>
Valora esta pregunta


0