Welcome Guest, Not a member yet? Register   Sign In
importing a csv into the db
#14

[eluser]alberto24[/eluser]
ok - here's the code i tried....

Code:
<?php
include_once( 'base.php' );
class Csvimport extends Base {

function Csvimport ()
    {
        parent::Base();
        $this->load->database();        
        
    }


function index ()
    {  
        $query = $this->db->query("LOAD DATA INFILE '/web/content/csv/test1.csv' REPLACE INTO TABLE csvtest FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\\n' (f_name, l_name, country, @dummy, phone) SET customer_id = '14'");
        
        if ($query) {
            $data['message'] = "All items imported successfully.";
        } else {
            $data['message'] = "Import failed.";
        }

    }

}
?>

I get the following error:

Quote:A Database Error Occurred
Error Number: 1045

Access denied for user '369706_cloud1'@'%' (using password: YES)

LOAD DATA INFILE '/www.cloudcontacts.com/web/content/csv/test1.csv' REPLACE INTO TABLE csvtest FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' (f_name, l_name, country, @dummy, phone) SET customer_id = '14'

All my other controllers work fine and can read/write to the db so I am not sure why it says access denied. Any ideas?

thanks


Messages In This Thread
importing a csv into the db - by El Forum - 11-03-2008, 08:27 PM
importing a csv into the db - by El Forum - 11-03-2008, 09:34 PM
importing a csv into the db - by El Forum - 11-04-2008, 04:15 AM
importing a csv into the db - by El Forum - 11-04-2008, 05:06 AM
importing a csv into the db - by El Forum - 11-04-2008, 05:12 AM
importing a csv into the db - by El Forum - 11-04-2008, 05:22 AM
importing a csv into the db - by El Forum - 11-04-2008, 05:26 AM
importing a csv into the db - by El Forum - 11-04-2008, 05:46 AM
importing a csv into the db - by El Forum - 11-04-2008, 05:49 AM
importing a csv into the db - by El Forum - 11-04-2008, 08:42 AM
importing a csv into the db - by El Forum - 11-04-2008, 11:09 AM
importing a csv into the db - by El Forum - 11-04-2008, 11:13 AM
importing a csv into the db - by El Forum - 11-04-2008, 11:27 AM
importing a csv into the db - by El Forum - 11-04-2008, 02:31 PM
importing a csv into the db - by El Forum - 11-04-2008, 02:46 PM
importing a csv into the db - by El Forum - 11-04-2008, 03:00 PM
importing a csv into the db - by El Forum - 11-04-2008, 03:16 PM
importing a csv into the db - by El Forum - 11-04-2008, 03:29 PM
importing a csv into the db - by El Forum - 11-04-2008, 03:39 PM
importing a csv into the db - by El Forum - 11-04-2008, 03:50 PM
importing a csv into the db - by El Forum - 11-04-2008, 03:54 PM
importing a csv into the db - by El Forum - 11-04-2008, 03:59 PM
importing a csv into the db - by El Forum - 11-04-2008, 05:50 PM
importing a csv into the db - by El Forum - 11-04-2008, 05:53 PM
importing a csv into the db - by El Forum - 11-04-2008, 06:00 PM
importing a csv into the db - by El Forum - 11-04-2008, 06:35 PM
importing a csv into the db - by El Forum - 11-04-2008, 06:45 PM
importing a csv into the db - by El Forum - 11-21-2009, 02:32 PM
importing a csv into the db - by El Forum - 11-22-2009, 01:05 AM
importing a csv into the db - by El Forum - 08-04-2011, 01:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB