RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting

read second line or record of csv file

Join Date: May 2007
Location: USA
Posts: 3,176
Reputation: Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold 
Rep Power: 15
Solved Threads: 314
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Sensei

Re: read second line or record of csv file

  #6  
Jul 23rd, 2007
This code opens and reads a line into $line until there are no more lines:
  1. <?php
  2. $fp = fopen('file.csv', 'r');
  3. while (!feof($fp)) {
  4. $line = fgetcsv($fp, 4096);
  5. echo $line; // do whatever you need here
  6. }
  7. fclose($fp);
  8. ?>

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 2:08 pm.
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:15 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC