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

hola amigos espero me puedan ayudar necesito imprimir el resultado de una consulta sql en un archivo txt en formato de tabla

de esta manero creo el archivo txt
Código PHP:
Ver original
  1. header("Content-disposition: attachment; filename=$downloadfile");
  2. header("Content-Type: application/force-download");
  3. header("Content-Transfer-Encoding: binary");
  4. header("Content-Length: ".strlen($filecontent));
  5. header("Pragma: no-cache");
  6. header("Expires: 0");



de esta manera construyo la tabla y la visualizo en una pagina pero en un archivo txt no puedo


<table width="845" class="table table-striped table-bordered bootstrap-datatable datatable table-hover" id="example">
<thead>
<tr>
<th width="27"><a href="#">N°</a></th>
<th width="149"><a href="#">Fecha Inicial</a></th>
<th width="94"><div align="center"><a href="#">Fecha Final</a></div></th>
<th width="366"><div align="center"><a href="#">Fenomenos</a></div></th>
<th width="185"><div align="center"><a href="#">Opciones</a></div></th>
</tr>
</thead>
<?
$cont = 1;
foreach($fl as $field)

{
?>
<tr>
<td><?php echo $cont?></td>
<td><div align="left"><?php echo $field['fecha_in']?></div></td>
<td class="center"><div align="center"><?php echo $field['fecha_fin']?></div></td>
<td class="center"><div align="center"><?php echo $field['fenomeno']?></div></td>
<td class="center"><div align="right"><a class="btn btn-primary" href="index.php?controller=user_&accion=list_one_u ser&id_usuarios=<? echo $field['id_usuarios']?>" title="Consulta Usuario"><i class="icon-search icon-white"></i>Consultar</a></div>
<?php

$cont++;

}

?></td>
</tr>
</table>