RE: [PHP] getting fields out of a csv file

From: Date: Mon, 24 Jul 2000 20:14:54 +0000
Subject: RE: [PHP] getting fields out of a csv file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7961@lists.php.net to get a copy of this message
Thanks, this works great. Now I'm wondering how to sort on one of the fields (happens to be a date). It is the fourth field, so I'm trying somehow to sort on $data[any][4] Any suggestions? Chris > -----Original Message----- > From: Jason Cox [mailto:jasonc@webpipe.net] > Sent: Monday, July 17, 2000 11:27 PM > To: Chris Murtland > Cc: php-general@lists.php.net > Subject: Re: [PHP] getting fields out of a csv file > > > 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 > > -- > 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 >

« previous php.general (#7961) next »