•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,631 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,783 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1780 | Replies: 6
![]() |
Here's a tutorial that should get you there:
http://www.goodphptutorials.com/track/62
http://www.goodphptutorials.com/track/62
This code opens and reads a line into $line until there are no more lines:
file_get() can be used as well, to load each line into an array, if you prefer to work with it like that.
php Syntax (Toggle Plain Text)
<?php $fp = fopen('file.csv', 'r'); while (!feof($fp)) { $line = fgetcsv($fp, 4096); echo $line; // do whatever you need here } fclose($fp); ?>
file_get() can be used as well, to load each line into an array, if you prefer to work with it like that.
Last edited by Ezzaral : Jul 23rd, 2007 at 1:08 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- How to read data from csv file in an array and parse (C++)
- Need Help Reading a csv file created from MSExcel (C)
- Reading in a *.csv file and loading the data into an Array (Java)
Other Threads in the PHP Forum
- Previous Thread: is it possible to store a query?
- Next Thread: PHP Badword Filter (Intermediate)



Linear Mode