Ver Mensaje Individual
  #11 (permalink)  
Antiguo 19/12/2011, 01:59
jarjausroy
 
Fecha de Ingreso: diciembre-2011
Mensajes: 50
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Exportar consulta .csv

He investigado por el foro y he conseguido el siguiente codigo que me sirvio, ahora si me genera el .csv con la consulta.

Código PHP:
<?php
include "Connections/cn.php"; 
mysql_select_db($database_cn, $cn);  
$rpedidos=mysql_query("select * from provincias"); 
while (
$reg = mysql_fetch_array($rpedidos)) { 
    
$shtml = $shtml.$reg["PROVINCIA"]."\n"; 
} 
//$shtml=$excel; 
//$shtml=$shtml."</table>"; 
header("Content-Description: File Transfer"); 
header("Content-Type: application/force-download"); 
header("Content-Disposition: attachment; filename=pedidos.csv"); 
echo 
$shtml;  

?>

MUCHAS GRACIAS POR SU PACIENCIA. SALUDOSSS!!!!