简体   繁体   中英

LOAD DATA LOCAL INFILE - php 5.5 not working

I moved from one server (php 4.5) to a new server (php 5.5) and the attach script is not running (means not writing to the DB) :

<?php
$db = mysqli_init();
mysqli_real_connect($db, 'localhost', 'user', 'pass','db_name');

mysqli_select_db($db, 'db_name');

$insert_data= "LOAD DATA LOCAL INFILE 'http://123.co.il/file/some_file.csv'
INTO TABLE guests
FIELDS TERMINATED BY ',' ENCLOSED BY ''
LINES TERMINATED BY '\n';";

mysqli_query($db,$insert_data);
?>

please, some help? Thanks, Mor

Hi the solution is: replace the path from the url , direct to the file: ' http://123.co.il/file/some_file.csv ' - > 'some_file.csv'

<?php
$db = mysqli_init();
mysqli_real_connect($db, 'localhost', 'user', 'pass','db_name');

mysqli_select_db($db, 'db_name');

$insert_data= "LOAD DATA LOCAL INFILE 'some_file.csv'
INTO TABLE guests
FIELDS TERMINATED BY ',' ENCLOSED BY ''
LINES TERMINATED BY '\n';";

mysqli_query($db,$insert_data);
?>

hope it will help to others. Mor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM