MySQL Forums
Forum List  »  Italian

Fatal error: Query Failed! SQL: SELECT * INTO OUTFILE
Posted by: Ilic Radice
Date: April 26, 2020 05:58AM

Buongiorno a tutt*!

Non riesco a capire perché la query sottostante funzioni con PhpMyAdmin e dal client di MariaDB (mysql client) e non se eseguo da PHP.

Errore:
Fatal error: Query Failed! SQL: SELECT * INTO OUTFILE '/var/www/html/domain.dom/tmp/qry_patients_11_11.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY " " FROM qry_patients ; - Error: in /var/www/html/domain.dom/export_csv.php on line 90

Linea 90 e le precedenti:

$tbl_name = "qry_patients"; // table name of the selected db
$FileName = "/var/www/html/domain.dom/tmp/".$tbl_name."_".date("h_i").".csv";
$query = "SELECT * INTO OUTFILE '".$FileName."' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY \"\n\" FROM ".$tbl_name." $result = mysqli_query($linkDB, $query) OR trigger_error("Query Failed! SQL: $query - Error: ".mysqli_error(), E_USER_ERROR);

Dopo 3 giorni di tentativi non so più cosa provare.

Lo so che si può fare la stessa cosa con fputcsv() ma vorrei capire il motivo di questo strano comportamento.

Ciao. Ilic

Options: ReplyQuote


Subject
Views
Written By
Posted
Fatal error: Query Failed! SQL: SELECT * INTO OUTFILE
786
April 26, 2020 05:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.