> $line = fgets($handle);
> list($col1, $col2, $col3) = $line;
> echo "c1 is $col1 and c2 is $col2 and c3 is $col3".'<br>'; // this shows
> just 1st char of each field
That's odd, I would have expected $col1, $col2, and $col3 to be NULL.
That's what I get when I try to assign a string to list(). It expects
a PHP array.
You could tackle this in a couple of different ways. Either split your
string into an array first:
$line = fgets($handle);
$columns = explode(",", trim($line));
list($col1,$col2,$col3) = $columns;
Or look at using fgetcsv(), which will save you a step or two:
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php