H
H
Hawk20242016-05-13 22:25:11
PHP
Hawk2024, 2016-05-13 22:25:11

Why might the export of records from the database to Excel not work?

The site needs to implement an export from the database to Excel. There are over 2,000,000 entries in the database. The problem is that when more than 1,000 records are selected, the script stops working (everything works through ajax requests and simply nothing is returned back).
There is a suggestion that this may be related to the time the script is running on the server, but solving a similar problem using set_time_limit() does not help.
Can you please tell me what is causing this and how can I solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
netyshka, 2016-05-14
@Hawk2024

first you need to do the export through - SELECT ... INTO OUTFILE
If the column names are static, then write well in front

SELECT назст1 , назвст2, назвст3
UNION
)
SELECT nazv1, nazv2,nazv3  INTO OUTFILE file.csv FIELDS TERMINATED BY ',' ENCLOSED BY '"'
 LINES TERMINATED BY '\r\n'
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question