importing a csv into the db |
[eluser]alberto24[/eluser]
[quote author="ray73864" date="1225857031"]as i said before, you need to copy the file to a temporary directory, php can copy to /tmp/ so create an upload script that uploads the file to /tmp/ then use that in the load data infile and when the import is complete have php 'unlink' the file.[/quote] same error with the tmp file here's the full error: Code: A Database Error Occurred and full code Code: function index ()
[eluser]ray73864[/eluser]
i would ask that you change the 'capelite' to something else as that is the name of a business i am doing a website for. the error you have given sounds like your mysql username does not have the 'FILE' permission granted on it, dunno if your host would be willing to give it to you, i don't see why not though since they should be able to grant that permission on a per-database basis.
[eluser]alberto24[/eluser]
[quote author="ray73864" date="1225864224"]i would ask that you change the 'capelite' to something else as that is the name of a business i am doing a website for. the error you have given sounds like your mysql username does not have the 'FILE' permission granted on it, dunno if your host would be willing to give it to you, i don't see why not though since they should be able to grant that permission on a per-database basis.[/quote] Thanks Ray - changed the file name - sorry about that. If the import doesn't work, how come it doesn't spit out the error message and instead just sits there blank?
[eluser]ray73864[/eluser]
in my full code for it, $data['message'] is going to a view $this->load->view('import',$data); if you want to see the error message then you will need to echo it out somewhere, for testing purposes you could just do: Code: if ($query)
[eluser]alberto24[/eluser]
fyi in speaking with host now - they tell me that my db user is set to the highest possible level of permissions
[eluser]megabyte[/eluser]
Solved, I had a silly typo. I tried load data infile. Any ideas why I am getting this error? Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL Here is my table structure, the last 3 columns in the table do not exist inthe csv and are to be updated later. Code: --
[eluser]umefarooq[/eluser]
hi try this library its is working fine to import CSV in you database have look on it. really nice library. http://codeigniter.com/wiki/CSVReader/
[eluser]btray77[/eluser]
I know this is an old thread, but I've run into this same problem... try adding LOCAL like: Code: LOAD DATA LOCAL INFILE This works on my server, without local it does not work on my shared host. -Brad |
Welcome Guest, Not a member yet? Register Sign In |