Help about importing data from csv to mysql - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Help about importing data from csv to mysql (/showthread.php?tid=44326) |
Help about importing data from csv to mysql - El Forum - 08-11-2011 [eluser]Wondering Coder[/eluser] Hi to all, I'm been trying to upload a .csv file and save it to my table. But it gives me an error. this is my model Code: function save_csv($data) Code: if($save) and this is the error that gives me: Code: A Database Error Occurred Help about importing data from csv to mysql - El Forum - 08-11-2011 [eluser]leonardteo[/eluser] Never used this function before but you might need quotes around $data. If you see the docs there are single quotes around the filename: http://dev.mysql.com/doc/refman/5.1/en/load-data.html Another way to do this is to read it in using fgetcsv (http://php.net/manual/en/function.fgetcsv.php) then use active record to create each record. Probably less efficient... L. Help about importing data from csv to mysql - El Forum - 08-11-2011 [eluser]Wondering Coder[/eluser] got it working already and your right by adding quotes in my variable. haha. anyway this is it for today. Time to sleep. @_@ |