Help about importing data from csv to mysql |
[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
[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.
[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. @_@ |
Welcome Guest, Not a member yet? Register Sign In |