Im trying to do a simple task of reading a csv file which i can do fine, and i read it to an array and i want to assign each value for to a variable and write it out to a text file in the order i need.
This is what i have so far.
Code: Select all
$file_handle = fopen("test.csv", "r");
while (!feof($file_handle) ) {
$line_of_text = fgetcsv($file_handle, 10240);
$lines = implode("<BR>",$line_of_text);
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $lines);
fclose($fh);
print $lines;
}
Thanks for the help!
Also one other thing, I cannot save $lines_of_text[1] to a file either. Nothing gets written in the txt file