I've been using a simple script to export data to a .txt or .csv file. But I have noticed that my exports don't match others. And a friend has asked me to make adjustments to my code so he can upload what I export.
here is my simple export script:
<?
$contents = "Happy Buddy"."\t";
$contents .= "hold Circle"."\t";
$contents .= "Hollywood"."\t";
$contents .= "CA"."\t";
$contents .= "90210"."\n";
$contents .= "Tony Macker"."\t";
$contents .= "Crow Ave"."\t";
$contents .= "Hollywood"."\t";
$contents .= "CA"."\t";
$contents .= "90210"."\n";
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=something.csv");
header("Pragma: no-cache");
header("Expires: 0");
print "$contents";
?>
This will export just fine, but it doesn't seem to add "commas" to the Comma Separated Value file! I must be missing something.
here is what gets exported:
Happy Buddy hold Circle Hollywood CA 90210
Tony Macker Crow Ave Hollywood CA 90210
This is what I'm trying to accomplish:
"Happy Buddy","hold Circle","Hollywood","CA","90210"
"Tony Macker","Crow Ave","Hollywood","CA","90210"
Any ideas of what I'm doing that is not quite exporting to the expected way?
From what my buddy tells me, there is a weird BOX-like character that shows up. I think it's carriage return, but it's a guess.
thanks to anyone with a better understanding on this!