| | |
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
| Thread Tools | Search this Thread |
5.2.10 action apache api array beginner beneath binary broken cakephp checkbox class classes cms code cron curl database date destroy display dynamic echo echo$_get[x]changingitintovariable... email encode error fcc file files folder form forms function functions google header howtowriteathesis href htaccess html image images include insert ip javascript joomla limit link local login mail memberships menu mlm mod_rewrite multiple multipletables mysql mysqlquery neutrality oop open passwords paypal pdf php provider query radio random record remote rss script search server sessions sockets source space sql strip_tags syntax system table template thesishelp tutorial update upload url validator variable video voteup web window.onbeforeunload=closeme; youtube






