![]() |
How to import CSV file into database including mapping using Codeigniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How to import CSV file into database including mapping using Codeigniter (/showthread.php?tid=31208) |
How to import CSV file into database including mapping using Codeigniter - El Forum - 06-10-2010 [eluser]yagie[/eluser] Can someone help me how to import CSV file into database including mapping using Codeigniter? I don't know how. I'm looking for the example but I haven't found it. Thanks.. How to import CSV file into database including mapping using Codeigniter - El Forum - 06-10-2010 [eluser]Clooner[/eluser] You could use fgetcsv to read the csv file and then run a foreach and insert each row using AR. Code: $data = fgetcsv($filehandle) How to import CSV file into database including mapping using Codeigniter - El Forum - 06-10-2010 [eluser]Clooner[/eluser] Actually this is not how it works when I think about it. You'll be able to find how to use fgetcsv on php.net manuals! How to import CSV file into database including mapping using Codeigniter - El Forum - 06-10-2010 [eluser]yagie[/eluser] Thanks Clooner for your replay. I used library for csv (csvreader). And then, I combined it with the code "foreach" you give and it works.. |