reading csv file by line

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

reading csv file by line

Post by itsmani1 »

Hi all


I want to read a csv file line by line. What should be the 2nd argument of fread so that i can read line by line

Code: Select all

 
 
if (!$handle = fopen($filename, 'w+'))
{
    echo "Cannot open file ($filename)";
    exit;
}
else
{
        fread($handle,....);
        fclose($handle);
}
 
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: reading csv file by line

Post by requinix »

Use fgetcsv instead of fread.
Post Reply