Bobafart
09-18-2009, 08:47 PM
Hello, I am trying to create a script that output a csv file from data I am querying from a mySQL table. Keep getting this error:
Fatal error: Call to undefined function phpheader() in /home/foo/bar/exportmycsv.php on line 1
<?php
header('Content-type: application/x-msdownload');
header('Content-Disposition: attachment; filename=exportcsv.csv');
header('Pragma: no-cache');
header('Expires: 0');
include("myconnect.php");
$sql = "SELECT theDate,theTitle,theContent FROM mycal ORDER BY theDate ASC";
$result = mysql_query($sql);
if($result){
echo "Subject,Start Date,Start Time,End Date,End Time,All Day Event,Description,Location,Private\r\n"; //header
while($row = mysql_fetch_array($result)){
echo "\"$row[theTitle]\",\"$row[theDate]\",\"false\",\"$row[theDate]\",\"false\",\"false\",\"$row[theContent]\",\",\"false\"\r\n"; //data
}
}
?>
can someone tell me what I am doing incorrect? it all appears satisfactory to my eyes
Fatal error: Call to undefined function phpheader() in /home/foo/bar/exportmycsv.php on line 1
<?php
header('Content-type: application/x-msdownload');
header('Content-Disposition: attachment; filename=exportcsv.csv');
header('Pragma: no-cache');
header('Expires: 0');
include("myconnect.php");
$sql = "SELECT theDate,theTitle,theContent FROM mycal ORDER BY theDate ASC";
$result = mysql_query($sql);
if($result){
echo "Subject,Start Date,Start Time,End Date,End Time,All Day Event,Description,Location,Private\r\n"; //header
while($row = mysql_fetch_array($result)){
echo "\"$row[theTitle]\",\"$row[theDate]\",\"false\",\"$row[theDate]\",\"false\",\"false\",\"$row[theContent]\",\",\"false\"\r\n"; //data
}
}
?>
can someone tell me what I am doing incorrect? it all appears satisfactory to my eyes