开发者

database not responding after a limit

I have an problem in fetching records from database with php.

I have 31700 records in database. when i fetches records from this开发者_JS百科 query:

select * from product_likes

Then, script was aborted and blank page was showing.but when i use limit in query (i.e. "select * from product_likes limit 0, 12000;") then it is giving upto 12000 records.

And when i fecthes records from this query:

select product_name, like_count from product_likes

Then, script was aborted and blank page was showing.but when i use limit in query (i.e. "select product_name, like_count from product_likes limit 0, 30000;") then it is giving upto 30000 records.

I can't understand where is the problem. And still i can't fetch all records.

Please let me know the reason, How can i overcome this problem...


You may need to modify some server variables like PHP's memory_limit and MySQL's max_allowed_packet. But I wouldn't show that many items in a single page. Your server will not respond after more than a few visitors start to visit your web page.


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

There's just so much wrong with this statement its hard to know where to start.

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

And learn how to use a different tool which does not run in PHP (e.g. the mysql command line client) so you can seperate issues in your code from issues in your data from issues in the tools you are using.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜