elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Tutorial básico de Quickjs


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  PHP Error enpaginado
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: PHP Error enpaginado  (Leído 1,432 veces)
tomasvreal28

Desconectado Desconectado

Mensajes: 12


Ver Perfil
PHP Error enpaginado
« en: 6 Diciembre 2015, 23:39 pm »

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
  1. <?php
  2. require_once('conexion.php');
  3.  
  4. if (isset($_POST['busc'])){
  5. $fecha_reporte=$_POST['fecha_reporte'];
  6. $fecha_reporte2=$_POST['fecha_reporte2'];
  7.  
  8. $sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_fecha_ri>='$fecha_reporte'
  9. and icr_fecha_ri<='$fecha_reporte2' order by icr_fecha_ri ASC ";
  10. }else{
  11. $sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";
  12. }
  13. $reg=mysql_query($sql,$cnx);
  14.  
  15. ?>
  16.  
  17.  
  18. <?php
  19. require_once('conexion.php');
  20. $num_registros=mysql_num_rows($reg);
  21. if($num_registros==0){
  22.  echo "No existen registros";
  23.  exit(0);  
  24.  }
  25. $registros=5;
  26. $pagina=$_GET['num'];
  27. if(is_numeric($pagina)){
  28.  $inicio=($pagina - 1)*$registros;
  29.  }
  30. else{
  31.  $inicio=0;
  32.  }
  33. $sql="select * from tbldocumentosicr order by icr_fecha_ri  limit $inicio,$registros";
  34. $reg=mysql_query($sql,$cnx);
  35. $paginas=ceil($num_registros/$registros);
  36. ?>
  37.  
  38.  
  39.  
  40. <html>
  41. <head>
  42.  
  43. <title>Listado</title>
  44.  
  45. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  46.  
  47.    <script type="text/javascript" src="jquery.quick.pagination.min.js"></script>
  48.    <script type="text/javascript" src="jquery.quick.pagination.js"></script>
  49.    <script type="text/javascript" src="calendar.js"></script>
  50.    <script type="text/javascript" src="calendar-setup.js"></script>
  51.    <script type="text/javascript" src="calendar-es.js"></script>
  52.    <style type="text/css"> @import url("calendar-win2k-cold-1.css"); </style>
  53.  
  54. <script type="text/javascript" language="javascript">
  55.   function cambiar(id,color){
  56.       document.getElementById(id).style.backgroundColor=color;
  57.   }
  58. </script>
  59.  
  60. <style type="text/css">
  61.   body,td,th {
  62.   color: #000000;
  63.   }
  64.   body {
  65.   }
  66. a:link {
  67.   color: #0058B0;
  68.   text-decoration: none;
  69. }
  70. a:visited {
  71.   text-decoration: none;
  72. }
  73. a:hover {
  74.   text-decoration: none;
  75. }
  76. a:active {
  77.   text-decoration: none;
  78. }
  79. .Estilo4 {color: #004080}
  80. </style>
  81.  
  82.  
  83. </head>
  84. <body>
  85. <form action="reportlima.php" method="POST" >
  86.  
  87. <table BGCOLOR="F9FBFC" BORDERCOLOR="EAEAEB"  BORDER="1" width="33%" align="center" cellpadding="1" >
  88. <tr>
  89.   <td colspan=7 align="center" BGCOLOR="C1D4D6" style="color:#000000"><h2><strong>Consulta</strong></h2></td>
  90. </tr>
  91.  
  92. <tr>
  93. <TD colspan=5 align=left><B>Fecha Notificacion RI</B></TD>
  94. <TR>
  95.   <TD colspan=4 align=right><B> Desde:</B></TD>
  96.   <TD colspan=2 align=left> <input name="fecha_reporte" type="text" id="fecha_reporte" style="background-color:#FBF9D5"/>
  97.   <button type="submit" id="button1">....</button>
  98.   <script type="text/javascript">                Calendar.setup({
  99.                                inputField    : "fecha_reporte",
  100.                                button        : "button1",
  101.                                align         : "center"
  102.                              });
  103.                               </script></TD>
  104. </TR>
  105.  
  106. <TR>
  107.   <TD colspan=4 align=right><B> Hasta:</B></TD>
  108.   <TD colspan=2 align=left> <input type="text" name="fecha_reporte2" id="fecha_reporte2" style="background-color:#FBF9D5"/>
  109.   <button type="submit" id="button2">....</button>
  110.   <script type="text/javascript">                Calendar.setup({
  111.                                inputField    : "fecha_reporte2",
  112.                                button        : "button2",
  113.                                align         : "center"
  114.                              });
  115.                               </script></TD>
  116. </TR>
  117.  
  118. <TR>
  119.    <TD colspan=7>
  120.    <br/>
  121. <center>  
  122.   <input type="submit" name="busc" value="Buscar" style='width:100px; height:35px'>
  123.   <input type="button" name="reg" value="Regresar" style='width:100px; height:35px' onClick="history.back()">
  124. </center>
  125. </table>
  126.  
  127. </form>
  128. <br></br>
  129. <table width="100%"  align="center" cellspacing="0">
  130.   <TD align=left><input type="submit" name="exporta" value="Exportar a Excel"  style='width:150px; height:35px'>
  131.  
  132. </TD>
  133. </table>
  134.  
  135. <table width="100%"  BORDER=3  align="center" cellspacing="0" BORDERCOLOR="#939393" BGCOLOR="F9FBFC">
  136.  
  137. <tr>
  138.   <td BGCOLOR="C1D4D6" width="25" align=center><h5>Nª</h5></td>
  139.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>DEPENDENCIA</h5></td>
  140.   <td BGCOLOR="C1D4D6" width="85" align=center><b><h5>CODIGO</h5></b></td>
  141.   <td BGCOLOR="C1D4D6" width="150" align=center><h5>N CUENTA</h5></td>
  142.   <td BGCOLOR="C1D4D6" width="230" align=center><h5>NOMBRE</h5></td>
  143.   <td BGCOLOR="C1D4D6" width="100" align=center><h5>CODIGO RESLUCION</h5></td>
  144.   <td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA NOTIFICACION</h5></td>
  145.   <td BGCOLOR="C1D4D6" width="330" align=center><h5>CAUSAL DE INGRESO</BR>DERECAUDACION</h5></td>
  146.   <td BGCOLOR="C1D4D6" width="100" align=center><h5>TIPO MONTO<BR> A TRASLADAR</h5></td>
  147.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>OBSERVACIONES</h5></td>
  148.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>PERIODOS DE REVISION</h5></td>
  149.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>MONTO A TRASLADAR</h5></td>
  150.   <td BGCOLOR="C1D4D6" width="70" align=center><h5>ESTADO</h5></td>
  151.  
  152. </tr>
  153. <?php
  154. $i=0;
  155. while($res=mysql_fetch_array($reg)){
  156.   ?>
  157.   <tr style="background-color:#f0f0f0" id="<?php echo $i;?>" onMouseMove="cambiar('<?php echo $i;?>','#cccccc')" onMouseOut="cambiar('<?php echo $i;?>','#f0f0f0')">
  158.  
  159.    <td width="25" align=center><h5><?php echo $res[''];?></h5></td>
  160.    <td width="90" align=center><h5>00<?php echo $res['icr_dependencia'];?></h5></td>
  161.    <td width="85" align=center><h5><?php echo $res['icr_codigo'];?></h5></td>
  162.    <td width="150" align=center><h5><?php echo $res['icr_cuenta_bn'];?></h5></td>
  163.    <td width="230" align=justify><h6><?php echo $res['icr_nombre'];?></h6></td>
  164.    <td width="100" align=center><h5>0<?php echo $res['icr_dependencia'];?>024000<?php echo $res['icr_num_resolucion'];?></h5></td>
  165.    <td width="100" align=center><h5><?php echo $res['icr_fecha_ri'];?></h5></td>
  166.    <td width="330" align=justify><h5><?php echo $res['icr_causal'];?></h5></td>
  167.  
  168.    <td width="90" align=center>
  169.     <h5>
  170.       <?php if($res["icr_traslado"]==1){?>
  171.       Saldo Parcial
  172.       <?php }elseif($res["icr_traslado"]==2){?>
  173.       Saldo Total
  174.       <?php }?>    
  175.      </h5></td>
  176.  
  177. <td width="90" align=justify><h6><?php echo $res['icr_observaciones_a'];?></h6></td>
  178.  
  179. <td width="90" align=justify><h6><?php echo $res[''];?></h6></td>
  180.  
  181.  
  182. <td width="90" align=center>
  183.  
  184. <?php
  185.    $data = explode('-', $res['icr_fecha_revision1']);
  186.    echo date('F \d\e\l Y', strtotime($data[0] . '-' . $data[1])); ?> -
  187.  
  188. <?php
  189.    $data = explode('-', $res['icr_fecha_revision2']);
  190.    echo date('F \d\e\l Y', strtotime($data[0] . '-' . $data[1])); ?>
  191.  
  192. </td>
  193.  
  194.   <td width="90" align=center><h5><?php echo $res['icr_monto_icr'];?></h5></td>
  195.  
  196.   <td width="70" align=center>
  197.    <h5>
  198.      <?php if($res["icr_estado"]==5){?>Notificado con RI
  199.      <?php }elseif($res["icr_estado"]==6){?>Reportado
  200.      <?php }?>
  201.      </h5></td>
  202.  
  203. </tr>
  204.   <?php
  205.   $i=$i+1;
  206.   }
  207.   ?>
  208. </table>
  209.  
  210. <tr>
  211. <td align="center" bgcolor="#FFFFFF"><h3><strong>Total de Registros:
  212.   <span class="Estilo4">
  213.     <?php
  214. $cantidad = "select count(icr_num_accion) from tbldocumentosicr  where icr_estado='5'";
  215. $total= mysql_query($cantidad) or die(mysql_error());
  216. $total_registros = mysql_result($total,0,0);
  217. ?>
  218.      <?php echo $total_registros;?> <br></span></strong><strong>Registros Encontrados: <span class="Estilo4">
  219.      <?php
  220. $cantidad = "select count(icr_num_accion) from tbldocumentosicr where icr_fecha_ri>='$fecha_reporte' and icr_fecha_ri<='$fecha_reporte2'";
  221. $total= mysql_query($cantidad) or die(mysql_error());
  222. $total_registros = mysql_result($total,0,0);
  223. ?>
  224.      <?php echo $total_registros;?></span></strong></h3></td>
  225. </tr>
  226.  
  227.  
  228.  
  229.  
  230. <?php
  231. if($pagina>1)
  232. echo "<a href='reportlima.php?num=".($pagina -1)."' >Anterior</a> ";
  233. for($cont=1;$cont<=$paginas;$cont++){
  234. if($cont==$pagina)
  235. echo $cont ." ";
  236. else
  237. echo "<a href='reportlima.php?num=".$cont."' >$cont</a> ";
  238. }
  239. if($pagina<$paginas)
  240. echo "<a href='reportlima.php?num=".($pagina +1)."' >Siguiente</a> ";
  241. ?>
  242. </body>
  243. </html>
  244.  
  245.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines