Foros del Web » Programando para Internet » PHP »

PHP OO Paginacion

Estas en el tema de Paginacion en el foro de PHP en Foros del Web. Hola quisiera saber como puedo hacer una paginacion a este codigo Código PHP: <?php require_once( 'conexion.php' ); if (isset( $_POST [ 'busc' ])){ $estado = $_POST ...
  #1 (permalink)  
Antiguo 03/12/2015, 14:28
 
Fecha de Ingreso: noviembre-2015
Mensajes: 21
Antigüedad: 8 años, 4 meses
Puntos: 0
Paginacion

Hola quisiera saber como puedo hacer una paginacion a este codigo

Código PHP:
<?php

require_once('conexion.php');


if (isset(
$_POST['busc'])){
$estado=$_POST['estado'];
$tipac=$_POST['tipac'];
$num_accion=$_POST['num_accion'];
$num_ruc=$_POST['num_ruc'];



$sql="select * from tbldocumentosicr where icr_estado='$estado'  or  icr_tipo_accion='$tipac' or icr_num_accion='$num_accion' or icr_ruc='$num_ruc'   order by icr_fecha_registro ASC";

}else{

$sql="select * from tbldocumentosicr order by icr_fecha_registro ASC";

}

$reg=mysql_query($sql,$cnx);



?>



<html>

<head>

<title>Reporte</title>



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


<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: #000;

    }

    body {

    }

</style>

<script> 
function abrir() { 
open('alerta.php','','top=300,left=300,width=350,height=300,menubar=yes,scrollbars=yes,resizable=yes'); 

</script> 


</head>

<body onload="abrir()">



<form action="listar_icr.php" method="POST" >

<table BGCOLOR="F9FBFC" BORDERCOLOR="EAEAEB"  BORDER="1" width="900" align="center" cellpadding="1" >

<tr>

   <td colspan=6 align="center" BGCOLOR="C1D4D6" style="color:#000000"><h2><strong>Consulta</strong></h2></td>

</tr>


<tr>

   <td align=left><B><h5>Numero de Acci&oacute;n:</h5></B>

   <td align=left> <input type="text" name="num_accion" onmouseover="this.style.backgroundColor='#FDFDF8'" style="background-color:#FBF9D5" onMouseOut="this.style.backgroundColor='#FBF9D5'"/>

   </td>


<td align=left><B>

 <h5>Tipo de Accion:</h5>

 </B></td>
<td align=left> 

   <SELECT NAME="tipac" style="background-color:#FBF9D5" >

        <OPTION value="---" selected>Elegir</OPTION>

        <OPTION value="2">Orden de Fiscalizaci&oacute;n</OPTION>

        <OPTION value="1">Acci&oacute;n Inductiva</OPTION>

   </SELECT></td> 

   

<TR>

   <TD align=left><B><h5>RUC:</h5></B>

   <TD align=left> <input type="text" name="num_ruc"  onmouseover="this.style.backgroundColor='#FDFDF8'" style="background-color:#FBF9D5" onMouseOut="this.style.backgroundColor='#FBF9D5'"/>

   </TD>



   <TD align=left><B><h5>Estado:</h5></B></TD>

   <TD align=left> 

        <SELECT name="estado" style="background-color:#FBF9D5">

        <OPTION value="---" selected>Elegir</OPTION>

        <option value="1">Registrado</option>

        <option value="2">Con Comunicaci&oacute;n</option>

        <option value="3">Notificaci&#243n Comunicaci&#243n</option>

        <option value="4">Con Resoluci&oacute;n</option>

        <option value="5">Notificado con RI</option>

        <option value="6">Reportado a Lima</option>

        </SELECT></TD>
</TR> 



<TR> 

   <TD colspan=6>

    <br/>

    <center>   

     <input type="submit" name="busc" value="Buscar" style='width:100px; height:35px'>

</table>



</form>

<br></br>


<table width="100%"  align="center" cellspacing="0">
    <TD align=left><input type="submit" name="reporta" value="Reportar" onClick="location.href='reportlima.php'" style='width:150px; height:35px'></TD>
</table>


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


<tr>

 <td colspan=17 align="center" bgcolor="#FFFFFF"><h2><strong></strong></h2></td>

</tr>


<tr>  

   <td BGCOLOR="C1D4D6" width="85" align=center><h5>TIPO DE ACCI&#211N</h5></td>

   <td BGCOLOR="C1D4D6" width="90" align=center><h5>NÚMERO DE ACCI&#211N</h5></td>

   <td BGCOLOR="C1D4D6" width="230" align=center><h5>CONTRIBUYENTE</h5></td>

   <td BGCOLOR="C1D4D6" width="85" align=center><b><h5>RUC</h5></b></td>

   <td BGCOLOR="C1D4D6" width="230" align=center><h5>INFRACCI&#211N <br>COMETIDA</h5></td>

   <td BGCOLOR="C1D4D6" width="75" align=center><h5>FECHA<BR>REGISTRO</h5></td>

   <td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA EMISION<BR>COMUNICACI&#211N</h5></td> 

   <td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA<BR>NOTIFICACI&#211N<BR>COMUNICACI&#211N</h5></td>

   <td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA<BR>VENCIMIENTO<BR>COMUNICACI&#211N 10 dias habiles</h5></td>

   <td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA EMISION<BR>RESOLUCI&#211N</h5></td>

   <td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA<BR>NOTIFICACI&#211N RI</h5></td>

   <td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA<BR>VENCIMIENTO<BR>RESOLUCI&#211N 15 dias habiles </h5></td>

   <td BGCOLOR="C1D4D6" width="90" align=center><h5>FECHA<BR>REPORTE</h5></td> 

   <td BGCOLOR="C1D4D6" width="90" align=center><h5>ESTADO</h5></td>

   <td BGCOLOR="C1D4D6" width="125" align=center></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="85" align=center>

    <?php if($res['icr_tipo_accion']==2){?>Orden Fiscalización<?php }
          elseif(
$res['icr_tipo_accion']==1){?>Acción Inductiva<?php }
    
?>      

</td>

    <td width="90" align=center><a href="reporte.php?num_accion=<?php echo $res[1];?>"><strong><?php echo $res['icr_num_accion'];?></strong></a></td>

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

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

    <td width="230" align=justify>

    <?php if($res['icr_infraccion']==1){?>Inciso b) numeral 9.3: Condici&oacute;n de domicilio fiscal NO HABIDO

        <?php }elseif($res['icr_infraccion']==2){?>Inciso c) numeral 9.3: No comparecer o comparecer fuera del plazo establecido.

        <?php }elseif($res['icr_infraccion']==3){?>Inciso d) numeral 9.3: No emitir y/o no otorgar CDP, distintos a gu&iacute;as de remisi&oacute;n (num.1, art.174&deg; CT)

        <?php }elseif($res['icr_infraccion']==4){?>Inciso d) numeral 9.3: Omitir llevar libros y/o registros y/o otros medios de control (num.1, art.175&deg; CT)

        <?php }elseif($res['icr_infraccion']==5){?>Inciso d) numeral 9.3: No presentar declaraciones determinativas dentro de los plazos (num.1, art.176&deg; CT)

        <?php }elseif($res['icr_infraccion']==6){?>Inciso d) numeral 9.3: No exhibir libros, registros u otros documentos solicitados (num.1, art.177&deg; CT)

        <?php }elseif($res['icr_infraccion']==7){?>Inciso d) numeral 9.3: No declarar ingresos, rentas, patrimonio, tributos retenidos, o declarar datos falsos

    <?php }?></td>


    <td width="75" align=center><?php echo $res['icr_fecha_registro'];?></td>

    <td width="100" align=center><?php echo $res['icr_fecha_comunicacion'];?></td> 

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

        
    <td width="90" align=center><?php

    $fechaactual
=date("Y-m-d");

    

    if(
$res['icr_fecha_venci_not_comu']<=$fechaactual){

    
?>

    <font color="#FF0000"> <?php echo $res['icr_fecha_venci_not_comu'];?></font>

     <?php }else{     ?>

      <?php echo $res['icr_fecha_venci_not_comu'];?>

     <?php }     ?>

     </td>





     

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

    

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

    

    <td width="90" align=center><?php

     $fechaactual
=date("Y-m-d");



   if(
$res['icr_fecha_venci_resol']<=$fechaactual){

    
?>

    <font color="#FF0000"> <?php echo $res['icr_fecha_venci_resol'];?></font>

     <?php }else{     ?>

      <?php echo $res['icr_fecha_venci_resol'];?>

     <?php }     ?>

     </td>

 

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



    <td width="90" align=center>

    <?php if($res["icr_estado"]==1){?>Registrado

        <?php }elseif($res["icr_estado"]==2){?>Con Comunicaci&oacute;n

        <?php }elseif($res["icr_estado"]==3){?>Notificaci&#243n Comunicaci&#243n

        <?php }elseif($res["icr_estado"]==4){?>Con Resoluci&oacute;n

        <?php }elseif($res["icr_estado"]==5){?>Notificado con RI

        <?php }elseif($res["icr_estado"]==6){?>Reportado

    <?php }?>
   </td>



    <td width="125" align=justify><a href="registro_comun.php?num_accion=<?php echo $res[1];?>"><strong>1.- Comunicaci&#243n</strong></br>

    <a href="registro_resolu.php?num_accion=<?php echo $res[1];?>"><strong>2.- Resoluci&#243n</strong></br>
    <a href="registro_notif_ri.php?num_accion=<?php echo $res[1];?>"><strong>3.- Notificaci&#243n RI</br></strong></td>
  <!---  <a href="reportlima.php"><strong>4.- Reportar</strong></a></td>  --->

</tr>

    <?php

    $i
=$i+1;

    }

    
?>

</table>



<tr>

 <td colspan=17 align="center" bgcolor="#FFFFFF"><strong>Total de Registros:</strong>
<?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;?>
</td>
</tr>
</br>
<tr>

 <td colspan=17 align="center" bgcolor="#FFFFFF"><strong>Registros Encontrados:</strong>
<?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;?>
</td>
</tr>

</body>

</html>
  #2 (permalink)  
Antiguo 03/12/2015, 16:10
Avatar de herzbazi  
Fecha de Ingreso: febrero-2012
Mensajes: 612
Antigüedad: 12 años, 1 mes
Puntos: 36
Respuesta: Paginacion

muy facil de usar y muy bueno

espeo te sirva

http://www.sitepoint.com/demos/jquery-quick-pagination/
__________________
Enseña todo lo que sepas...
Aprende todo lo que puedas..

Etiquetas: fecha, html, mysql, paginacion, 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 14:25.