Foros del Web » Programando para Internet » PHP »

PHP OO Error enpaginado

Estas en el tema de Error enpaginado en el foro de PHP en Foros del Web. Hola Estoy tratando de empaginar Me empaginan normal Por ejemplo me muestra 30 registros totales y me empagina 10 por hoja hasta ahi normal Pero ...
  #1 (permalink)  
Antiguo 06/12/2015, 16:38
 
Fecha de Ingreso: noviembre-2015
Mensajes: 21
Antigüedad: 8 años, 5 meses
Puntos: 0
Error enpaginado

Hola
Estoy tratando de empaginar
Me empaginan normal
Por ejemplo me muestra 30 registros totales
y me empagina 10 por hoja hasta ahi normal

Pero a la hora de hacer la busqueda por fechas no me funciona la busqueda
es decir no me lista el resultado

Todo lo contrario me sigue mostranto todos los registros



Código PHP:
<?php
require_once('conexion.php');

if (isset(
$_POST['busc'])){
$fecha_reporte=$_POST['fecha_reporte'];
$fecha_reporte2=$_POST['fecha_reporte2'];

$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_fecha_ri>='$fecha_reporte' 
and icr_fecha_ri<='$fecha_reporte2' order by icr_fecha_ri ASC "
;
}else{
$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";
}
$reg=mysql_query($sql,$cnx);

?>


<?php
require_once('conexion.php');
$num_registros=mysql_num_rows($reg);
if(
$num_registros==0){
  echo 
"No existen registros";
  exit(
0);  
  }
$registros=5;
$pagina=$_GET['num'];
if(
is_numeric($pagina)){
  
$inicio=($pagina 1)*$registros;
  } 
else{
  
$inicio=0;
  }
$sql="select * from tbldocumentosicr order by icr_fecha_ri  limit $inicio,$registros";
$reg=mysql_query($sql,$cnx);
$paginas=ceil($num_registros/$registros); 
?>



<html>
<head>

<title>Listado</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <script type="text/javascript" src="jquery.quick.pagination.min.js"></script>
    <script type="text/javascript" src="jquery.quick.pagination.js"></script>
    <script type="text/javascript" src="calendar.js"></script>
    <script type="text/javascript" src="calendar-setup.js"></script>
    <script type="text/javascript" src="calendar-es.js"></script>
    <style type="text/css"> @import url("calendar-win2k-cold-1.css"); </style>

<script type="text/javascript" language="javascript">
   function cambiar(id,color){
        document.getElementById(id).style.backgroundColor=color;
   }
</script>

<style type="text/css">
    body,td,th {
    color: #000000;
    }
    body {
    }
a:link {
    color: #0058B0;
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}
a:hover {
    text-decoration: none;
}
a:active {
    text-decoration: none;
}
.Estilo4 {color: #004080}
</style>


</head>
<body>
<form action="reportlima.php" method="POST" >

<table BGCOLOR="F9FBFC" BORDERCOLOR="EAEAEB"  BORDER="1" width="33%" align="center" cellpadding="1" >
<tr>
   <td colspan=7 align="center" BGCOLOR="C1D4D6" style="color:#000000"><h2><strong>Consulta</strong></h2></td>
</tr>
   
<tr>
<TD colspan=5 align=left><B>Fecha Notificacion RI</B></TD> 
<TR>
    <TD colspan=4 align=right><B> Desde:</B></TD>
    <TD colspan=2 align=left> <input name="fecha_reporte" type="text" id="fecha_reporte" style="background-color:#FBF9D5"/>
    <button type="submit" id="button1">....</button>
    <script type="text/javascript">                  Calendar.setup({
                                      inputField    : "fecha_reporte",
                                      button        : "button1",
                                      align         : "center"
                                    });
                                    </script></TD>
</TR>

<TR>
    <TD colspan=4 align=right><B> Hasta:</B></TD>
    <TD colspan=2 align=left> <input type="text" name="fecha_reporte2" id="fecha_reporte2" style="background-color:#FBF9D5"/>
    <button type="submit" id="button2">....</button>
    <script type="text/javascript">                  Calendar.setup({
                                      inputField    : "fecha_reporte2",
                                      button        : "button2",
                                      align         : "center"
                                    });
                                    </script></TD>
</TR>

<TR> 
    <TD colspan=7>
    <br/>
<center>   
    <input type="submit" name="busc" value="Buscar" style='width:100px; height:35px'>
    <input type="button" name="reg" value="Regresar" style='width:100px; height:35px' onClick="history.back()">
</center>
</table>

</form>
<br></br>
<table width="100%"  align="center" cellspacing="0">
    <TD align=left><input type="submit" name="exporta" value="Exportar a Excel"  style='width:150px; height:35px'>

</TD>
</table>

<table width="100%"  BORDER=3  align="center" cellspacing="0" BORDERCOLOR="#939393" BGCOLOR="F9FBFC">

<tr>
   <td BGCOLOR="C1D4D6" width="25" align=center><h5>Nª</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>DEPENDENCIA</h5></td>
   <td BGCOLOR="C1D4D6" width="85" align=center><b><h5>CODIGO</h5></b></td>
   <td BGCOLOR="C1D4D6" width="150" align=center><h5>N CUENTA</h5></td>
   <td BGCOLOR="C1D4D6" width="230" align=center><h5>NOMBRE</h5></td>
   <td BGCOLOR="C1D4D6" width="100" align=center><h5>CODIGO RESLUCION</h5></td>
   <td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA NOTIFICACION</h5></td>
   <td BGCOLOR="C1D4D6" width="330" align=center><h5>CAUSAL DE INGRESO</BR>DERECAUDACION</h5></td>
   <td BGCOLOR="C1D4D6" width="100" align=center><h5>TIPO MONTO<BR> A TRASLADAR</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>OBSERVACIONES</h5></td>
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>PERIODOS DE REVISION</h5></td> 
   <td BGCOLOR="C1D4D6" width="90" align=center><h5>MONTO A TRASLADAR</h5></td>
   <td BGCOLOR="C1D4D6" width="70" align=center><h5>ESTADO</h5></td>

 </tr>
<?php
$i
=0;
while(
$res=mysql_fetch_array($reg)){
    
?>
   <tr style="background-color:#f0f0f0" id="<?php echo $i;?>" onMouseMove="cambiar('<?php echo $i;?>','#cccccc')" onMouseOut="cambiar('<?php echo $i;?>','#f0f0f0')">
    
    <td width="25" align=center><h5><?php echo $res[''];?></h5></td>
    <td width="90" align=center><h5>00<?php echo $res['icr_dependencia'];?></h5></td>
    <td width="85" align=center><h5><?php echo $res['icr_codigo'];?></h5></td>
    <td width="150" align=center><h5><?php echo $res['icr_cuenta_bn'];?></h5></td>
    <td width="230" align=justify><h6><?php echo $res['icr_nombre'];?></h6></td>
    <td width="100" align=center><h5>0<?php echo $res['icr_dependencia'];?>024000<?php echo $res['icr_num_resolucion'];?></h5></td>
    <td width="100" align=center><h5><?php echo $res['icr_fecha_ri'];?></h5></td>
    <td width="330" align=justify><h5><?php echo $res['icr_causal'];?></h5></td>

    <td width="90" align=center>
      <h5>
        <?php if($res["icr_traslado"]==1){?>
        Saldo Parcial
        <?php }elseif($res["icr_traslado"]==2){?>
        Saldo Total
        <?php }?>    
      </h5></td>
        
<td width="90" align=justify><h6><?php echo $res['icr_observaciones_a'];?></h6></td>

<td width="90" align=justify><h6><?php echo $res[''];?></h6></td>


<td width="90" align=center>

<?php
    $data 
explode('-'$res['icr_fecha_revision1']);
    echo 
date('F \d\e\l Y'strtotime($data[0] . '-' $data[1])); ?> -

<?php
    $data 
explode('-'$res['icr_fecha_revision2']);
    echo 
date('F \d\e\l Y'strtotime($data[0] . '-' $data[1])); ?>
    
</td>

    <td width="90" align=center><h5><?php echo $res['icr_monto_icr'];?></h5></td>

   <td width="70" align=center>
     <h5>
       <?php if($res["icr_estado"]==5){?>Notificado con RI
       <?php }elseif($res["icr_estado"]==6){?>Reportado
       <?php }?>
      </h5></td>

</tr>
    <?php
    $i
=$i+1;
    }
    
?>
</table>

<tr>
 <td align="center" bgcolor="#FFFFFF"><h3><strong>Total de Registros:
   <span class="Estilo4">
     <?php
$cantidad 
"select count(icr_num_accion) from tbldocumentosicr  where icr_estado='5'";
$totalmysql_query($cantidad) or die(mysql_error());
$total_registros mysql_result($total,0,0);
?>
      <?php echo $total_registros;?> <br></span></strong><strong>Registros Encontrados: <span class="Estilo4">
      <?php
$cantidad 
"select count(icr_num_accion) from tbldocumentosicr where icr_fecha_ri>='$fecha_reporte' and icr_fecha_ri<='$fecha_reporte2'";
$totalmysql_query($cantidad) or die(mysql_error());
$total_registros mysql_result($total,0,0);
?>
      <?php echo $total_registros;?></span></strong></h3></td>
</tr>




<?php
if($pagina>1)
echo 
"<a href='reportlima.php?num=".($pagina -1)."' >Anterior</a> ";
for(
$cont=1;$cont<=$paginas;$cont++){
if(
$cont==$pagina)
 echo 
$cont ." ";
 else
 echo 
"<a href='reportlima.php?num=".$cont."' >$cont</a> ";
}
if(
$pagina<$paginas)
 echo 
"<a href='reportlima.php?num=".($pagina +1)."' >Siguiente</a> ";
 
?>
</body>
</html>

Etiquetas: fecha, html, mysql, registro, select, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:41.