Skip to content

loadData () error #771

Open
Open
@Slesh654321

Description

@Slesh654321

hi.
i can't seem to make the loadData() method work.
can u post an example of csv file?
i have a table with this structure:
id( autoincrement), a,b,c,d

and my csv looks like this:
"a";"b";"c";"d"

but when i try to load it i get an error:
Fatal error: Uncaught exception 'Exception' with message 'Unprepared Query Failed, ERRNO: 1045 (Access denied for user '####'@'localhost' (using password: YES))' in /home/admin/web/localhost.example.com/public_html/assets/db/MysqliDb.php:501 Stack trace: #0 /home/admin/web/localhost.example.com/public_html/assets/db/MysqliDb.php(1089): MysqliDb->queryUnprepared('LOAD DATA INFI...') #1 /home/admin/web/localhost.example.com/public_html/assets/csv.php(15): MysqliDb->loadData('test', 'Book1.csv', Array) #2 {main} thrown in /home/admin/web/localhost.example.com/public_html/assets/db/MysqliDb.php on line 501

the code looks like this:

$db = new MysqliDb ($dblogin); //initiate db object	
	$path_to_file = "Book1.csv";
	$options = Array(
	"fieldChar" => ';', 	// Char which separates the data
	"lineChar" => '\r\n', 	// Char which separates the lines
	"linesToIgnore" => 1	// Amount of lines to ignore at the beginning of the import
);
	$db->loadData("test", $path_to_file, $options);

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions