Buenas estoy tratando de descargar a excel
pero necesito que a la hora de descargar se registre la fecha y se cambie el estado 5 al 6
de todos los registros que descargo
<?php
require_once('conexion.php');
header ("Cache-Control: no-cache, must-revalidate"); header ("Content-Type: application/vnd.ms-excel"); header ("Content-Disposition: attachment; filename=reporte.xls" );
$sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";
?>
<table width="100%" align="center" cellspacing="0">
<tr><td colspan="12" width="25" align=center><h5>TITULO</h5></td></tr>
<tr><td colspan="12" width="90" align=center><h5>TITULO </h5></td></tr>
<tr><td colspan="12" width="150" align=center><h5>TITULO PERIODO:</h5></td></tr>
</table>
<table width="100%" BORDER=3 align="center" cellspacing="0" BORDERCOLOR="#939393" BGCOLOR="FFFFFF">
<tr>
<td width="25" align=center valign="top" BGCOLOR="C1D4D6"><h5>Nª</h5></td>
<td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>DEPENDENCIA</h5></td>
<td width="85" align=center valign="top" BGCOLOR="C1D4D6"><b><h5>CODIGO</h5></b></td>
<td width="150" align=center valign="top" BGCOLOR="C1D4D6"><h5>N CUENTA</h5></td>
<td width="230" align=center valign="top" BGCOLOR="C1D4D6"><h5>NOMBRE</h5></td>
<td width="100" align=center valign="top" BGCOLOR="C1D4D6"><h5>CODIGO RESLUCION</h5></td>
<td width="100" align=center valign="top" BGCOLOR="C1D4D6"><h5>FECHA NOTIFICACION</h5></td>
<td width="450" align=center valign="top" BGCOLOR="C1D4D6"><h5>CAUSAL DE INGRESO DE RECAUDACION</h5></td>
<td width="100" align=center valign="top" BGCOLOR="C1D4D6"><h5>TIPO MONTO A TRASLADAR</h5></td>
<td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>OBSERVACIONES</h5></td>
<td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>PERIODOS DE REVISION</h5></td>
<td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>MONTO A TRASLADAR</h5></td>
</tr>
<?php
$i=0;
?>
<td width="25" align=center><h5><?php echo $i+1;?></h5></td>
<td width="90"><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"><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="450" 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=center>
<?php
$calendario_meses = array( 'January'=>'Enero',
'Febuary'=>'Febrero',
'March'=>'Marzo',
'April'=>'Abril',
'May'=>'Mayo',
'June'=>'Junio',
'July'=>'Julio',
'August'=>'Agosto',
'September'=>'Septiembre',
'October'=>'Octubre',
'November'=>'Noviembre',
'December'=>'Diciembre'
);
$data1 = explode('-', $res['icr_fecha_revision1']); $fecha1 = date('F \d\e\l Y', strtotime($data1[0] . '-' . $data1[1])); $fecha1 = strtr($fecha1, $calendario_meses);
echo $fecha1; ?> -
<?php
$calendario_meses2 = array( 'January'=>'Enero',
'Febuary'=>'Febrero',
'March'=>'Marzo',
'April'=>'Abril',
'May'=>'Mayo',
'June'=>'Junio',
'July'=>'Julio',
'August'=>'Agosto',
'September'=>'Septiembre',
'October'=>'Octubre',
'November'=>'Noviembre',
'December'=>'Diciembre'
);
$data2 = explode('-', $res['icr_fecha_revision2']); $fecha2 = date('F \d\e\l Y', strtotime($data2[0] . '-' . $data2[1])); $fecha2 = strtr($fecha2, $calendario_meses2); echo $fecha2; ?>
</td>
<td width="90" align=center><h5><?php echo $res['icr_monto_icr'];?></h5></td>
</tr>
<?php
$i=$i+1;
}
?>
</table>
</body>
</html>
si tienes una PK en la tabla puedes hacerlo fácil:
UPDATE tbldocumentosicr SET icr_estado = '6' WHERE pID = ' . $res['id'] . '
y envias esa consulta, obviamente que $res['id'] deberia de ser remplazado por el nombre de la PK que cargas