playaz Posted July 23, 2009 Share Posted July 23, 2009 Hi guys, This is probably very simple to do although I am having a few issues.. I just require a simple script to take a CSV file and loop through each line, each line should be ideally grabbed as an array to allow me to perform a standard INSERT to the mysql database. Can anyone point me in the direction of the best tutorial for this? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/167102-solved-csv-help/ Share on other sites More sharing options...
dzelenika Posted July 23, 2009 Share Posted July 23, 2009 First use function file() which reads file into array. Then use explode for each row (explode decompose splits string into array of pieces by given delimiter) Quote Link to comment https://forums.phpfreaks.com/topic/167102-solved-csv-help/#findComment-881065 Share on other sites More sharing options...
Bendude14 Posted July 23, 2009 Share Posted July 23, 2009 Look here.. http://us3.php.net/manual/en/function.fgetcsv.php Quote Link to comment https://forums.phpfreaks.com/topic/167102-solved-csv-help/#findComment-881066 Share on other sites More sharing options...
MadTechie Posted July 23, 2009 Share Posted July 23, 2009 research time 4 seconds resource google http://www.codewalkers.com/c/a/Database-Code/PHP-CSV-Importer-20/ Quote Link to comment https://forums.phpfreaks.com/topic/167102-solved-csv-help/#findComment-881067 Share on other sites More sharing options...
playaz Posted July 23, 2009 Author Share Posted July 23, 2009 Cheers guys! I sorted the problem - some fool had messed with the settings on my standard editor and set files to save in a MAC format rather than Unix - saved back to Unix and everything works as expected now!! Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/167102-solved-csv-help/#findComment-881070 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.