结果未显示大结果

时间:2016-06-10 07:32:05

标签: php mysql laravel

这令我头疼。它已经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

怪异。帮助任何人。

此致

3 个答案:

答案 0 :(得分:0)

结果集可能需要太多内存。这会导致致命错误,你激活了error_reporting吗?

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

您可以通过将此内容添加到脚本来设置更高的内存限制:

memory_get_peak_usage()

然后,您可以使用lebel.text来显示......以及内存消耗的峰值

答案 1 :(得分:0)

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

  1. 的max_execution_time
  2. memory_limit的
  3. 例如:

     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");
    

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

答案 2 :(得分:0)

我使用mssql遇到了这个问题。我的结果集限制为64512。 尝试设置MSSQL.TEXTSIZE或TEXTLIMIT。

如果php仍然忽略它,您也可以尝试配置FREETDS(/etc/freetds/freetds.conf @ubuntu)