Ver Mensaje Individual
  #7 (permalink)  
Antiguo 18/03/2013, 13:31
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: problema para exportar resultado de consutlta sql a archivo txt

hice uno cambios y asi estoy imprimiendo el archivo txt

Código PHP:
Ver original
  1. <?php
  2.  
  3. $archivo = 'views/archivo.txt';
  4.  
  5. $handler = fopen($archivo,'w+');
  6.  
  7.    
  8. fwrite($handler,'Fecha Inicial');
  9. fwrite($handler,"\r\n");
  10. $cont = 1;
  11. foreach($fl as $field)
  12.        
  13.         {
  14.  
  15. fwrite($handler,$field['fecha_in']);
  16. fwrite($handler,"\r\n");
  17. //fwrite($handler,$field['fecha_fin']);
  18. }
  19. fclose($handler);
  20.  
  21.  
  22. header('Location:views/exportar2.php');
  23.  
  24.  
  25. ?>


y en exportar2.php
Código PHP:
Ver original
  1. <?php
  2. $archivo = 'archivo.txt';
  3. header('Content-Type: application/force-download');
  4. header('Content-Disposition: attachment; filename='.$archivo);
  5. header('Content-Transfer-Encoding: binary');
  6. header('Content-Length: '.filesize($archivo));
  7.  
  8. include($archivo);
  9.  
  10. ?>

hasta el momento tengo la primera columna como haga para imprimir otra columna?