2levelsabove Posted October 15, 2008 Share Posted October 15, 2008 OK so I am trying to import a CVS file with a ton of column fields. while (file is not empty) { $firstname=$data[1]; $lastname=$data[2]; blah blah blah } My question is that is there an easier way to assign the CVS column values to a variable ? Any feed back will be appreciated Quote Link to comment https://forums.phpfreaks.com/topic/128618-solved-cvs-file-import-with-a-ton-of-fields-s/ Share on other sites More sharing options...
Barand Posted October 15, 2008 Share Posted October 15, 2008 $file_handle = fopen ('myfile.csv', r)' while ($data = fgetcsv ($file_handle, 1024)) { list ($var1, $var2, $var3) = $data; // process vars } fclose ($file_handle); Quote Link to comment https://forums.phpfreaks.com/topic/128618-solved-cvs-file-import-with-a-ton-of-fields-s/#findComment-666579 Share on other sites More sharing options...
2levelsabove Posted October 15, 2008 Author Share Posted October 15, 2008 Hahahahahahahaahahaha badass!!!! you my friend have saved me a lot of time ! Quote Link to comment https://forums.phpfreaks.com/topic/128618-solved-cvs-file-import-with-a-ton-of-fields-s/#findComment-666582 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.