newbie import csv question
file is like:
stuff1,stuff2,stuff3
stuff1,stuff2,stuff3
stuff1,stuff2,stuff3
stuff1,stuff2,stuff3
etc.
Problem: when I try to parse out the 3 fields and display them using
list() it just gets just 1st char of each field ...
Q: How do I get it to set $col1 - 2 & $col3 to the full contents of
each for each line (not just 1st char)?
<?php
// on a mac but with windows linefeed returns in file
$handle = fopen("file:///path/_impfool/test.csv", "r");
while (!feof ($handle))
{
$line = fgets($handle);
list($col1, $col2, $col3) = $line;
echo $line.''.' line<br>'; // this shows the whole line ok
echo "c1 is $col1 and c2 is $col2 and c3 is $col3".'<br>'; // this
shows just 1st char of each field
}
?>
Thanks,
cool@xxxxxxxxxxxxxxxx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php