Log in

View Full Version : fgetcsv won't give me my array



tfit
04-26-2008, 03:43 PM
I trying to read a file so I can put it into my database. The problem is that the function fgetcsv won't separate it into an array, but just as a single array[0]. What am i missing here?

<?php
$handle = fopen("input.txt", "r");
while (($data = fgetcsv($handle, 1000, "*")) !== FALSE) {
print $data[0];
print $data[1];
}
fclose($handle);
?>

The input file is a number count to ten separated by "*". Odd thing it sometimes works once.

tfit
04-26-2008, 06:35 PM
Never mind I figured it out. Apparently I'm not allowed to use returns after my separator