Re: getting fields out of a csv file
| From: | Jason Cox | Date: | Tue, 18 Jul 2000 03:27:09 +0000 |
| Subject: | Re: getting fields out of a csv file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7015@lists.php.net to get a copy of this message | ||
Try something like this:
$fd = fopen ("/tmp/inputfile.txt", "r");
$count = 0;
while (!feof($fd))
{
$stuff = fgets($fd, 4096);
$data[$count] = explode(",", $stuff);
$count++;
}
fclose ($fd);
This would give you a multi-dimensional array of all your data indexed by
count and the number of colums.
Jason
----- Original Message -----
From: "Chris Murtland" <chris@studiomoxie.com>
To: <php-general@lists.php.net>
Sent: Monday, July 17, 2000 8:48 PM
Subject: [PHP] getting fields out of a csv file
> I am trying to get individual fields out of a .csv file I am reading in. I
> can see how to print out the data on each line, using fgetcsv, but how do
I
> isolate each field?
>
> Thanks,
> Chris
>
> ---------------------------------------------
> Chris Murtland
> Studio Moxie, LLC
> 336.773.1684
> 877.284.0462 fax/voicemail
> 62384610 ICQ
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
_______________________________________________________
Site Design, Hosting, and E-Commerce at www.webpipe.net