0

If I run the following query in the SQL box from PhpMyAdmin:

LOAD DATA INFILE '/home/sveiv/public_html/testload.txt' INTO TABLE testtable FIELDS TERMINATED BY ';'

everything works fine.

If I run the following script (testload.php)

<?php

$conn=mysqli_connect('localhost','username','password','dbname');

$conn->query("LOAD DATA INFILE '/home/sveiv/public_html/testload.txt' INTO TABLE testtable FIELDS TERMINATED BY ';'");
?>

nothing happens.

PS: The connection to the database has been established successfully.

Can anyone help me? Thank you very much!

  • $conn=mysqli_connect('localhost','username','password','db_name'); $conn->query("LOAD DATA INFILE '/home/sveiv/public_html/testload.txt' INTO TABLE testtable FIELDS TERMINATED BY ';'"); – Radu Stefan Jan 10 at 9:06
  • nothing happens Impossible. $conn->query must return something at least... is it TRUE? if not - what error occured? And - does the account used for a connection have FILE privilege? Does session secure_priv variable is not set? – Akina Jan 10 at 9:43
  • I apologize for not being clear. The customer service told me I have FILE privileges for using LOAD DATA INFILE without the option LOCAL. I belive they are right since the SQL query in PhpMyAdmin works fine. – Radu Stefan Jan 10 at 11:48
  • How can I get the error code for the query? – Radu Stefan Jan 10 at 11:48
  • The customer service told me So you're trying to do it on a REMOTE server? Now think - where PHP will search '/home/sveiv/public_html/testload.txt'? Do you really think it will search it on YOUR station and not on its own host? – Akina Jan 10 at 12:06

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.