| | |
read second line or record of csv file
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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 2:08 pm.
![]() |
Similar Threads
- Reading in a *.csv file and loading the data into an Array (Java)
- How to read data from csv file in an array and parse (C++)
- Need Help Reading a csv file created from MSExcel (C)
Other Threads in the PHP Forum
- Previous Thread: Need function to calculate normal cumulative density function please
- Next Thread: complex problems
Views: 4662 | Replies: 8
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery js limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube






