2016-06-10 56 views
1

这让我很头疼。它已经4个小时,我只是围绕它:(我的问题是当我从MySQL获取大的结果到PHP它不显示任何东西。总的结果是约20000+数据。所以我做的是极限结果到1000并没有显示结果如预期。结果不显示,如果结果很大

有一些配置,我需要设置或更改?

下面

我的示例查询不工作(当结果多于10000)

select * from `tbl_item` where `pricelist_id` = 1 and `published` = 'unpublished' and `type` = 'item' and `parent_id` = 0 and `tbl_item`.`status` <> 'inactive' order by `order` asc limit 10000 

工作(只限制结果为1000)

select * from `tbl_item` where `pricelist_id` = 1 and `published` = 'unpublished' and `type` = 'item' and `parent_id` = 0 and `tbl_item`.`status` <> 'inactive' order by `order` asc limit 1000 

奇怪。帮助任何人。

Regards,

+0

尝试'ini_set('memory_limit','254M'); //你的内存限制为字符串\t ini_set('max_execution_time',0);' –

+0

20000是MySql处理的数据量非常小,PHP配置或代码必须有错误。请向我们展示您的PHP代码,以及'memory_limit'和'max_execution_time'是否已设置? –

回答

0

也许结果集占用太多的内存。这会造成致命错误,您是否激活了error_reporting?

ini_set('display_errors', 1); 
error_reporting(-1); 

您可以通过添加这对您的脚本设置更高的内存限制:

ini_set('memory_limit', '2048M'); // would be really high, but good enough to investigate on the problem 

然后可以使用memory_get_peak_usage()显示......好吧,内存消耗的峰值

0

你需要在php.ini中更改以下值

  1. max_execution_time
  2. memory_limit

例如, :

in php.ini 
max_execution_time = 3000 // seconds 
memory_limit = 512M 

您可以在运行时使用ini_set()函数按以下方式更改此值。

ini_set("max_execution_time", "3000"); // seconds 
ini_set("memory_limit","512M"); 

您可以根据您的要求更改秒数。