Ver Mensaje Individual
  #7 (permalink)  
Antiguo 15/07/2004, 14:52
jviera
 
Fecha de Ingreso: junio-2004
Mensajes: 29
Antigüedad: 19 años, 10 meses
Puntos: 0
gracias por el dato, pero no se que es lo que pasa, pero el codigo no me funciona, echenle un vistazo, que esta mal?, esta es la pagina

exportar.php
<?
function Descargar($file){
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($file));
@readfile($file);
}

include("../pedidos/fcn/fcnConectarse.php");
$resultado=mysql_query("select * from pedidos");
$shtml="<table>";
$shtml=$shtml."<tr>";
$shtml=$shtml."<td>Periodo</td><td>Codigo_cta</td><td>cat11</td><td>id_item</td><td>tip_sum</td><td>cls_item</td><td>cant_item</td><td>ficha</td><td>actualiza</td><td>cerrado</td>";
$shtml=$shtml."</tr>";
while ($registro = mysql_fetch_array($resultado)) {
$shtml = $shtml."<tr><td>".$registro[periodo]."</td><td>".$registro[cod_cta]."</td><td>".$registro[cat11]."</td><td>".$registro[id_item]."</td><td>".$registro[tip_sum]."</td><td>".$registro[cls_item]."</td><td>".$registro[cant_item]."</td><td>".$registro[ficha]."</td><td>".$registro[actualiza]."</td><td>".$registro[cerrado]."</td></tr>";
}
$shtml=$shtml."</table>";
$scarpeta="./exportar"; //carpeta donde guardar el archivo.
//$clave=date("dmYHis");
//debe tener permisos 775 por lo menos
$sfile=$scarpeta."/"."xxxx.xls"; //ruta del archivo a generar
$fp=fopen($sfile,"w");
fwrite($fp,$shtml);
fclose($fp);
//echo "<a href='".$sfile."'>Haz click aqui</a><p></p>";
Descargar($sfile);
unlink($sfile)
?>