CSV file read fail (PHP )

Posted by user1020069 on Stack Overflow See other posts from Stack Overflow or by user1020069
Published on 2012-06-18T21:03:19Z Indexed on 2012/06/18 21:16 UTC
Read the original article Hit count: 192

Filed under:
|

I am trying to read a csv file (delimited by commas) but unfortunately, it isn't responding as it ought to. I am not so sure what I am doing wrong here, but I'll paste out the contents of the code and the CSV file both :

  $row = 0;
 if($handle = fopen("SampleQuizData.csv","r") !== FALSE)
 {
     // WORKS UNTIL HERE, SO FILE IS BEING READ
   while(!feof(handle)){
   $line = fgetcsv($handle, 1024, ",") ;
   echo $line[2];  // DOES NOT WORK

  }    
 }

And the CSV file is (the emails and names have been changed here to protect the identities of the users)

parijat,something,[email protected]
matthew,durp, [email protected]
steve,vai,[email protected]
rajni,kanth,[email protected]

© Stack Overflow or respective owner

Related posts about php

Related posts about csv