Database not responding after limitation

I am having a problem retrieving records from a database using php.

I have 31,700 entries in the database. when I retrieve the entries from this query:

select * from product_likes

Then the script was interrupted and a blank page was shown. But when I use the restriction in the request (ie "select * from product_likes limit 0, 12000;"), it will produce up to 12000 records.

And when I correct the entries from this query:

select product_name, like_count from product_likes

Then the script was interrupted and a blank page was shown. But when I use the restriction in the request (ie "select product_name, like_count from product_likes limit 0, 30000;"), then it gives up to 30,000 entries.

I can not understand where the problem is. And yet I can not get all the records.

Please let me know the reason, How can I solve this problem ...

+3
source share
2 answers

You may need to change some server variables, such as PHP memory_limitand MySQL max_allowed_packet. But I would not show that many elements on one page. Your server will not respond after more than a few visitors start visiting your web page.

+1
source

I run this query in a php program and want to show all the results on a web page

It's just so wrong with this statement it's hard to figure out where to start.

Use "LIMIT" in your query to retrieve data one page at a time - and show only one page at a time.

, , PHP (, mysql), - , .

0

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


All Articles