PHP & MYSQL EXPORTING CSV

I would like to know, how i can get the php script below to export and look the image i have upload?
[php]
$list = array (
array(‘aaa’, ‘bbb’, ‘ccc’, ‘dddd’),
array(‘123’, ‘456’, ‘789’),
array(’“aaa”’, ‘“bbb”’)
);

$fp = fopen(‘file.csv’, ‘w’);

foreach ($list as $fields) {
fputcsv($fp, $fields);
}

fclose($fp);
[/php]


To export a CSV you have to change the content type on the headers…

[php]header(‘Content-Type: text/csv; charset=utf-8’);
header(‘Content-Disposition: attachment; filename=file.csv’);[/php]

A better example is here…

Sponsor our Newsletter | Privacy Policy | Terms of Service