Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/02/2016, 14:59
tvreal28
 
Fecha de Ingreso: noviembre-2015
Mensajes: 21
Antigüedad: 8 años, 5 meses
Puntos: 0
Paginar Resultados

Buenas espero que me echen la mano
lo que pasa es que necesito paginar resultados pero que no recargue la pagina

es decir defaul.php?pagina=2

ya que mi enlace es
http://localhost/default.php?op=1067

y cuando doy siguiente me carga
es decir defaul.php?pagina=2
y no muestra los resultados

Código PHP:
<?php
session_start
();
require_once(
'conexion_2.php');
if (isset(
$_POST['busc'])){
$estado=$_POST['estado'];
$tipac=$_POST['tipac'];
$num_accion=$_POST['num_accion'];
$num_cod=$_POST['num_ruc'];
$sql="select * from tbldocumentosicr where icr_estado='$estado'  or  icr_tipo_accion='$tipac' or icr_num_accion='$num_accion' or icr_cod='$num_cod' order by icr_fecha_registro DESC";
}else{
$sql="select * from tbldocumentosicr order by icr_fecha_registro DESC";
}
$reg=mysql_query($sql,$cnx);

//Codigo para paginar 
$reg=mysql_query($sql,$cnx);
$tmp_rs mysql_query($sql);
$num_total_registros mysql_num_rows($tmp_rs);
//Limitar Busqueda 
$TAMANO_PAGINA 25;
//examinar la página a mostrar y el inicio del registro a mostrar
$pagina $_GET["pagina"];
if (!
$pagina) {
   
$inicio 0;
   
$pagina 1;
}
else {
   
$inicio = ($pagina 1) * $TAMANO_PAGINA;
}
//calcular el total de paginas
$total_paginas ceil($num_total_registros $TAMANO_PAGINA);
$consulta $sql."  LIMIT ".$inicio."," $TAMANO_PAGINA;
$reg mysql_query($consulta);?>

?>
<html>
<head>
<title>Sistema</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form action="default.php?op=1067" method="POST" >
<table>
<tr>
   <td><h4>Consultas</h4></td>
</tr>
<tr>
   <td><B><h5>Numero de accion</h5></B>
       <td><input type="text" name="num_accion"/></td>
   <td><B><h5>Tipo de Accion:</h5></B></td>
   <td><SELECT NAME="tipac">
        <OPTION value="---" selected>Elegir</OPTION>
        <OPTION value="2">Orden</OPTION>
        <OPTION value="1">Acci&oacute;n</OPTION>
   </SELECT></td>   
<tr>
   <td><B><h5>COD:</h5></B>
   <td> <input type="text" name="num_cod"/>
   </td>
   <td><B><h5>Estado:</h5></B></td>
   <td> 
        <SELECT name="estado">
        <OPTION value="---" selected>Elegir</OPTION>
        <option value="1">Registrado</option>
        <option value="2">Con Comunicaci&oacute;n</option>
        <option value="3">Notificaci&#243n</option>
        <option value="4">Con Res</option>
        <option value="5">Notificado</option>
        <option value="6">Reportado</option>
        </SELECT></td>
</tr> 
<tr> 
   <td colspan=6>
    <center><input type="submit" name="busc" value="Buscar"></center>
</table>
</form>
<table width="100%">
<tr>
  <td width="62" rowspan="2">TIPO DE ACCI&Oacute;N</td>
  <td width="67" rowspan="2">N&Uacute;MERO DE ACCI&Oacute;N</h6></td>
  <td width="195" height="1" rowspan="2">NOMBRE</td>
  <td width="18" rowspan="2">CODIGO</td>
  <td width="250" rowspan="2">INFRACCI&Oacute;N</td>
  <td width="64" rowspan="2">FECHA REGISTRO</td>
  <td colspan="3"><div align="center">FECHA COMUNI</div></td>
  <td colspan="3"><div align="center">FECHA RESO</div></td>
  <td width="58" rowspan="2">FECHA REPORTE</td>
  <td width="48" rowspan="2">ESTADO</td>
  <td width="50" rowspan="2">OPCIONES</td>
</tr>
<tr>  
   <td width="60" height="16">EMISI&Oacute;N<BR></td> 
   <td width="60">NOTIFICACI&Oacute;N<BR></td>
   <td width="60">VENCIMIENTO<BR></td>
   <td width="60">EMISI&Oacute;N<BR></td>
   <td width="60">NOTIFICACI&Oacute;N</td>
   <td width="60">VENCIMIENTO</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="62" align=center>
        <?php if($res['icr_tipo_accion']==2){?>
        Orden 
        <?php }
          elseif(
$res['icr_tipo_accion']==1){?>
        Acci&oacute;n
        <?php }
    
?></td>
 <td width="67" align=center><a href="usuarios/reporte.php?num_accion=<?php echo $res[1];?>"><?php echo $res['icr_num_accion'];?></a></td>
    <td width="195"<?php echo $res['icr_nombre'];?></td>
    <td width="18"<?php echo $res['icr_cod'];?></td>   
    <td width="250">
    <?php if($res['icr_infraccion']==1){?> b
        <?php }elseif($res['icr_infraccion']==2){?> esta
        <?php }elseif($res['icr_infraccion']==3){?> d 
        <?php }elseif($res['icr_infraccion']==4){?> o
        <?php }elseif($res['icr_infraccion']==5){?> a
        <?php }elseif($res['icr_infraccion']==6){?> b
        <?php }elseif($res['icr_infraccion']==7){?> c
    <?php }?></td>
    <td width="60" align=center><h6><?php echo $res['icr_fecha_registro'];?></h6></td>
    <td width="60" align=center><h6><?php echo $res['icr_fecha_comunicacion'];?></h6></td>     
    <td width="60" align=center><h6><?php echo $res['icr_fecha_noti_comu'];?></h6></td>   
    <td width="77" align=center><h6>
      <?php
    $fechaactual
=date("Y-m-d");    
    if(
$res['icr_fecha_venci_not_comu']<=$fechaactual AND ($res["icr_estado"]==3) ){
    
?>
      <font color="#FF0000"> <?php echo $res['icr_fecha_venci_not_comu'];?></font>
      <?php } else{     ?>
      <?php echo $res['icr_fecha_venci_not_comu'];?>
       <?php }     ?>     
     </h6></td>     
    <td width="60" align=center><h6><?php echo $res['icr_fecha_res'];?></h6></td>    
    <td width="60" align=center><h6><?php echo $res['icr_fecha'];?></h6></td>    
    <td width="60" align=center><h6>
      <?php
     $fechaactual
=date("Y-m-d");
   if(
$res['icr_fecha_venci_res']<=$fechaactual AND ($res["icr_estado"]==5) ){
    
?>
      <font color="#FF0000"> <?php echo $res['icr_fecha_venci_res'];?></font>
      <?php } else{     ?>
      <?php echo $res['icr_fecha_venci_res'];?>
       <?php }     ?>     
    </h6></td>
   <td width="60" align=center><h6><?php echo $res['icr_fecha_reporte'];?></h6></td> 
    <td width="48" align=center>
      <h6>
        <?php if($res["icr_estado"]==1){?>Registrado
        <?php }elseif($res["icr_estado"]==2){?>    Comun
        <?php }elseif($res["icr_estado"]==3){?>Notifi
        <?php }elseif($res["icr_estado"]==4){?>Con R
        <?php }elseif($res["icr_estado"]==5){?>Not
        <?php }elseif($res["icr_estado"]==6){?>Reportado
        <?php }?>   
    </td>
    <td width="50" align=justify valign="middle"><h6><a href="usuarios/registro_comun.php?num_accion=<?php echo $res[1];?>">Comun</a></br>
    <a href="usuarios/programacion/recaudacion/registro_resolu.php?num_accion=<?php echo $res[1];?>">Res</a></br></td>
</tr>
    <?php
    $i
=$i+1;
    }
    
?>
</table>
<table width="100%">
<tr>
<td width="8"></td>
<td width="474" align="left" >
//Codigo para paginado

<?php
if ($total_paginas 1) {
   if (
$pagina != 1)
      echo 
'<a href="'.$url.'?pagina='.($pagina-1).'" class="Estilo1" >Anterior < </a>';
      for (
$i=1;$i<=$total_paginas;$i++) {
         if (
$pagina == $i)
            
//Muestra el índice de la página actual
            
echo $pagina;
         else
            
//si el índice no corresponde con la página mostrada actualmente            
            
echo '  <a href="'.$url.'?pagina='.$i.'" class="Estilo1">'.$i.'</a>  ';
      }
      if (
$pagina != $total_paginas)
         echo 
'<a href="'.$url.'?pagina='.($pagina+1).'" class="Estilo1"> >Siguiente </a>';
}
?>
// Fin Codigo
</td>      
      <td width="105"></td>
      <td width="250" align="left"><strong>Total de Registros: <span class="Estilo4">
      <?php
$cantidad 
"select count(icr_num_accion) from tbldocumentosicr";
$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_estado='$estado' or icr_tipo_accion='$tipac' or icr_num_accion='$num_accion' or icr_ruc='$num_ruc'";
$totalmysql_query($cantidad) or die(mysql_error());
$total_registros mysql_result($total,0,0);
?>
        <?php echo $total_registros;?></span></strong></td>
 </tr>
</table>
</body>
</html>