I'm trying to read a csv file into an array. Here's what I've got so far for reading the csv into an array:
$i = 0;
while ($i < $fileLines) {
$userDB=Array(
($i) => Array
(
(title) => $harry[$i][0],
(subtitle) => $harry[$i][1],
(series) => $harry[$i][2],
(author) => $harry[$i][3],
(author2) => $harry[$i][4],
(author3) => $harry[$i][5],
(category) => $harry[$i][6],
(subjects) => $harry[$i][7],
(callnumber) => $harry[$i][8],
(isbn) => $harry[$i][9],
(publisher) => $harry[$i][10],
(keywords) => $harry[$i][11],
(option1) => $harry[$i][12],
(option2) => $harry[$i][13],
(option3) => $harry[$i][14],
(option4) => $harry[$i][15],
(option5) => $harry[$i][16],
(option6) => $harry[$i][17]
) // end child array
); // end parent array
$i++;
} // end while
Here is an example of the CVS I'm using:
"Algebra and Trigonometry with Analytic Geometry, Classic Edition",,,"Swokowski, Earl","Cole, Jeffery A.",,Cengage Learning,,,495559717,,,,," ALGEBRA AND TRIGONOMETRY WITH ANALYTIC GEOMETRY, CLASSIC EDITION 12 SWOKOWSKI, EARL COLE, JEFFERY A. CENGAGE LEARNING 2009-01-28 912 500 0495559717 "
All My Friends Are Dead,,,"Monsen, Avery","John, Jory",,Chronicle Books,,,811874559,,,,," ALL MY FRIENDS ARE DEAD MONSEN, AVERY JOHN, JORY CHRONICLE BOOKS 2010-06-30 96 500 0811874559 "
All My Friends Are Still Dead,,,"John, Jory","Monsen, Avery",,Chronicle Books,,,1452106967,,,,," ALL MY FRIENDS ARE STILL DEAD 3.2.2012 JOHN, JORY MONSEN, AVERY CHRONICLE BOOKS 2012-03-07 108 500 1452106967 "
My problem comes when I try to loop through writing to the array. If I comment out the while loop then I correctly read the first item in the CSV. However when I try and use the while loop then I don't get any data written to the array. What am I missing/doing completely wrong?
I haven't included all my code because I don't want to drown everyone, but I can include more if it will help.