On 3/20/2009 2:37 PM, "kirk.john...@zootweb.com" <kirk.john...@zootweb.com>
wrote:

> revDAVE <c...@hosting4days.com> wrote on 03/20/2009 03:11:00 PM:
> 
>> Newbie ... I'm trying to Trying to read / show a csv file line by line
> ...
> 
> fgetcsv is your friend.
> 
> http://us.php.net/manual/en/function.fgetcsv.php

Thanks Kirk for your help....

Hmmm - when I tried this example on the link - it echoed every field on it's
own line - but did NOT recognize the returns (each row) of the csv...

Q: how do I just pull out 1 whole row at a time?



<?php
$row = 1;
$handle = fopen("try3.csv", "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
    $num = count($data);
    echo "<p> $num fields in line $row: <br /></p>\n";
    $row++;
    for ($c=0; $c < $num; $c++) {
        echo $data[$c] . "<br />\n";
    }
}
fclose($handle);
?>





--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to