Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 23rd, 2005, 09:29 PM
Authorized User
 
Join Date: Dec 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading a .csv file

I have just resd the chapter on file operations, hoping to find some magic way of reading fields from a .csv file into an array.

Unless I missed something, the best I can do is read then entire line up to the LF character. Then I'm left to parse the line, looking for commas and quotes, separating it into fields the old-fashioned way.

Is there some magic I missed that would make this job easier?

Thanks!

 
Old March 1st, 2005, 10:57 AM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

The split function could break lines from a csv file at the commas
see: http://uk2.php.net/split

--
Don't Stand on your head - you'll get footprints in your hair. http://www.charlieharvey.org.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
parse a csv file shinny Pro Java 4 September 11th, 2006 06:26 AM
Getting .csv file name from the server langer123 Classic ASP Basics 0 April 13th, 2005 09:14 AM
Connectiong to .csv file langer123 Classic ASP Basics 1 March 31st, 2005 09:52 AM
Reading a csv file agongar Beginning VB 6 2 February 9th, 2005 12:39 PM
Reading CSV in DataReader salimgbelim ADO.NET 0 November 3rd, 2003 07:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.