|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-03-24 13:11 UTC] georg@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 05:00:02 2025 UTC |
Description: ------------ When issuing a LOAD DATA LOCAL INFILE statement, if the file is missing, mysqli_error() returns the empty string. The same query issued from the command line client returns the following message: ERROR: File '/path/to/nonexistent/file.txt' not found (Errcode: 2) mysqli_errno returns 2000 (CR_UNKNOWN_ERROR) Reproduce code: --------------- <?php $mysqli = mysqli_init(); $mysqli->options(MYSQLI_OPT_LOCAL_INFILE, 1); $connect = $mysqli->real_connect('xxx.xxx.xxx.xxx', 'xxxxxxxx', 'xxxxxxxxx', 'mydb'); $query = " LOAD DATA LOCAL INFILE '/path/to/nonexistent/file.txt' INTO TABLE mytable FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\r\n' "; $result = $mysqli->query($query); var_dump($result, $mysqli->errno, $mysqli->error); // $result: false // $mysqli->errno: 2000 (unknown error) // $mysqli->error: "" (empty string) ?> Expected result: ---------------- I expect to see an error message similar to the one returned by the command-line client, or at least a message that gives a clearer idea of what might have gone wrong. Actual result: -------------- Error message is the empty string