scott.stephan Posted August 10, 2009 Share Posted August 10, 2009 When using fgetcsv, you get an array of results. Let's call it $data. I believe I have this correct- $data is JUST the result for a ROW of a CSV, not the entire CSV, correct? IE- If there are 5 rows of data with 5 columns each, count() will return "5" not "25", correct? Quote Link to comment https://forums.phpfreaks.com/topic/169632-question-about-fgetcsv-and-data/ Share on other sites More sharing options...
.josh Posted August 10, 2009 Share Posted August 10, 2009 that's correct. You will have to loop through all of the rows and store a running total in a separate variable to get the total for the 'column' Quote Link to comment https://forums.phpfreaks.com/topic/169632-question-about-fgetcsv-and-data/#findComment-894926 Share on other sites More sharing options...
scott.stephan Posted August 10, 2009 Author Share Posted August 10, 2009 Great. I actually have a series of rows like A D D F And each requires a different kind of processing, so I just wanted to be able to say if($data[0] == 'A'){ process_a_row($data); } Quote Link to comment https://forums.phpfreaks.com/topic/169632-question-about-fgetcsv-and-data/#findComment-894945 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.