Answer the question
In order to leave comments, you need to log in
How to pass parameter local-infile=1 in drupal 7?
In general, the situation is as follows, there is a CSV file - approximately 200,000 lines (in principle, not the point), you need to quickly upload it to a Mysql table.
Accordingly, a form has been made that, by submission, must execute this query through db_query ()
db_query("
LOAD DATA LOCAL INFILE 'http://sitename.com/sites/default/files/example/example.csv'
INTO table example_table
CHARACTER SET 'UTF8'
FIELDS TERMINATED BY ';'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
");
db_query("
LOAD DATA LOCAL INFILE 'http://sitename.com/sites/default/files/example/example.csv'
INTO table example_table
CHARACTER SET 'UTF8'
FIELDS TERMINATED BY ';'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
", array('local-infile' => true));
Answer the question
In order to leave comments, you need to log in
www.zimplicit.se/en/knowledge/drupal-6-and-load-da...
$connection = mysqli_init();
mysqli_options($connection, MYSQLI_OPT_LOCAL_INFILE, true); //added to be able to run LOAD DATA LOCAL INFILE
@mysqli_real_connect($connection, $url['host'], $url['user'], $url['pass'], substr($url['path'], 1), $url['port'], NULL, MYSQLI_CLIENT_FOUND_ROWS);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question