| | |
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 |
apache api array basic beginner binary body broken cache cakephp class cms code computing confirm cron curl customizableitems database date date/time delete display dynamic echo email error file filter folder form forms forum function functions gc_maxlifetime google headmethod howtowriteathesis href htaccess html iframe image include ip javascript joomla limit link list login malfunction memmory memory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation oop parameter parsing paypal pdf php phpmysql query question random recourse recursion regex script search select seo server sessions snippet source space sql static system table thesishelp trouble tutorial update upload url variable video web webdesign xml youtube






