I am trying to retrieve column data from a csv file. The first two columns return fine, but for some reason I get Notice: Undefined offset: 2 when I try to reference the 3rd column of csv data. Here is what I believe to be the relevant code in question:
$handle = fopen($csv_file, 'r');
while(($fileop = fgetcsv($handle,1024, $delimiter)) !== false) {
echo $fileop[0]."<br/>";
echo $fileop[1]."<br/>";
echo $fileop[2]."<br/>"; //error occurs this line
}
The CSV file text:
THE GOLD CONNECTION,1760,2014-06-01
PINEFOREST JEWELRY,3034.25,2014-06-05
AMBERS DESIGN,2034.75,z
GOLD FALCON CUSTOM JEWELERS (PORT),78,
SUE'S JEWELRY,120,
JC JEWELERS,274,
ALTER'S GEM JEWELRY,74,
STALL JEWELERS,38,
ELEGANT JEWELERS,174,
ELEGANT JEWELERS,206,
SALEM'S JEWELERS,406,
How do I fix this? Thanks in advance