What I am trying to do is grab a Business Catalyst-generated CSV of my products. But it always includes a whole lot of stuff I don't need.
I have a script that uses fgetcsv(). The code is
<?php
$file_handle = fopen("ProductExport2.csv", "r");
while (!feof($file_handle) ) {
$line_of_text = fgetcsv($file_handle, 1000000);
$tableDisplay = "<tr><td>" . $line_of_text[0] . "</td><td>" . $line_of_text[1] . "</td><td>" . $line_of_text[2] . "</td><td>" . $line_of_text[4] . "</td><td>" . $line_of_text[6] . "</td><td>" . $line_of_text[49] . "</td></tr>";
echo $tableDisplay;
}
fclose($file_handle);
?>
All this does is display the data I want.
However, what I want to do now is write a new CSV file out of this. Using fwrite() only results in writing just the first entry of the data.
Any ideas?