He sustituido tal como me dijistes comillas:
Código PHP:
<?php
include "Connections/cn.php"; //Seleccionas la base
mysql_select_db($database_cn, $cn);
$sql = "SELECT * FROM provincias LIMIT 0, 30"; //había error de comillas
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)){
// echo $row['PROVINCIA'];
$shtml = $row ['PROVINCIA']. "\n";
// $shtml = $shtml.$row ['PROVINCIA']. "\n";
echo $shtml; //Imprimes los resultados
}
// define al archivo
$file='usuariocardiosito.csv';
if (!$file)
{
//el archivo no existe
die ("File not found");
}
else
{
//header("cache-control: public");
header("Content-Descrption: File Transfer");
header("content-disposition: attachment; filename=$file");
header("Content-Type: application/force-download");
}
?>
y me da el siguiente error
Cita: ALAVA ALBACETE ALICANTE ALMERIA AVILA BADAJOZ BALEARES BARCELONA BURGOS CACERES CADIZ CASTELLON CIUDAD REAL CORDOBA LA CORU CUENCA GERONA GRANADA GUADALAJARA GUIPUZCOA HUELVA HUESCA JAEN LEON LERIDA LA RIOJA LUGO MADRID MALAGA MURCIA
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Facturas\exportar.php:10) in C:\AppServ\www\Facturas\exportar.php on line 22
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Facturas\exportar.php:10) in C:\AppServ\www\Facturas\exportar.php on line 23
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Facturas\exportar.php:10) in C:\AppServ\www\Facturas\exportar.php on line 24