Mysqli_query returns false with error code 0, but the query is successful

I have a huge amount of data that is generated using a PHP script and must be inserted into the database. I tried various solutions with different results, but the current solution (and, in my opinion, should be the best) is that I generate the data in a CSV file and then paste it into the database with the following query:

LOAD DATA LOCAL INFILE 'myfile.csv' INTO TABLE t1 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY "'"

I use CodeIgniter as a PHP framework, and after the request has completed im, it is redirected to a page with an error that says only

Database error occurred

Error Number: 0

No error message or anything else.

I went through the code, but all I can find is that mysqli_query()returns false, and later mysqli_errno()returns 0 and mysqli_error()returns an empty string.

, , , , CSV . ? , , CodeIgniter mysqli_query() , .

MySQL Workbench, .

+3
2

, , .

require_once('connect.php'), , require_once, PHP .

require_once .

+1

LOAD INFILE php , google mysqli_set_local_infile_handler(). , / ?

: - , , , . , MySQL, PHP > 0, . , .

infile_handler .

0

Source: https://habr.com/ru/post/1785220/


All Articles