I wote this code to this and it works
the problem is that my csv file does not have the headers ID, Description , Category in the top of the file. I wrote this code
<?php
$list = array
(
"ID,Category,Description,,,,,,,,,,,,,,,,,,"
);
$file = fopen("DS20080507.csv","r+", 1000);
foreach ($list as $line)
{
fputcsv($file,split(',',$line));
}
fclose($file);
$row = 1;
$handle = fopen("DS20080507.csv", "r+");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
$row++;
for ($c=0; $c < $num; $c++) {
echo $data[$c] . "<br />\n";
}
}
fclose($handle);
?>
But it does not work right, it puts the headers in the top but deletes part of the first line of the csv file. I ve tries usine file mode a and a+ and puts the headrs in the bottom of the csv
any ideas on how to fix this issue?
Thank you