este es el codigo que estoy usando actualmente..
Código PHP:
<?
$conn = mysql_pconnect("localhost","root","");
mysql_select_db("planos", $conn);
$query = "SELECT * FROM `informacion`";
$resultado = mysql_query($query);
while ($registro = mysql_fetch_array($resultado)) {
$cod = str_pad($registro['cod_acudiente'], 16, "0", STR_PAD_LEFT);
$valor1 = $registro['nro_cuenta'].$registro['nom_colegio'].$registro['nom_cliente'].$cod."\n";
$valorarchivo .= $valor1;
}
$f1 = fopen("SEARF001","w+");
fwrite($f1,$valorarchivo);
mysql_close($conn);
fclose($f1);
$nombre_arch = "SEARF001";
header ('Content-Disposition: attachment; filename="'.$nombre_arch.'"');
header ("Content-Type: application/");
readfile($nombre_arch);
header ("Content-Length: ".strlen($res->archivo));
exit;
?>
Me podrias ubicar la respuesta anterior..