Page 1 of 1

PHP Large amounts of data export into EXECL

Posted: Tue Dec 08, 2009 2:48 am
by t240034137
This is my problems:
error: Allowed memory size of 31457280 bytes exhausted (tried to allocate 2 bytes) in D:\www\www\htdocs\netbar_ip1\include\class.db_mysql.php on line 39

my english is poor. i can not how to description this question.

I have 50M of data want to import into EXCEL 。but my code is not well.

who can help me? i want see your write code!

Re: PHP Large amounts of data export into EXECL

Posted: Tue Dec 08, 2009 3:02 am
by daedalus__

Code: Select all

ini_set("memory_limit","2000M");

Re: PHP Large amounts of data export into EXECL

Posted: Tue Dec 08, 2009 3:05 am
by t240034137
daedalus__ wrote:

Code: Select all

ini_set("memory_limit","2000M");
mycomputer memory is not so big!

Re: PHP Large amounts of data export into EXECL

Posted: Tue Dec 08, 2009 3:11 am
by t240034137

Code: Select all

 
include_once"./include/class.excel.php";//reference excel class
$xls = new Excel;//Instantiated class
$w=explode("limit",$where_str);//
$p=1000;//To check the number of data
if($ip_list_count%$p==0)
{
   $a=$ip_list_count/$p;
}
else
{
   $a=(int)($ip_list_count/$p)+1;
}
for($i=0;$i<=$a;$i++)
{
   //set_time_limit(0);
   $s=1000*$i;
   $ip=$_SG['db']->fetch_all("select * from main_info".$w[0]." limit {$s},{$p}");//The data from the database query
   $xls->addArray($ip);//Call the addArray method
   unset($ip);//Clear array
}
$xls->generateXML ("table".$i);//Call the generateXML method
exit();
}
 
I would like to use this method to solve the problem, but I failed

Re: PHP Large amounts of data export into EXECL

Posted: Tue Dec 08, 2009 3:15 am
by daedalus__
i dont know what that method is or what method you are currently using but increase the amount of available memory using the ini setting.

you don't have to set it to 2000M, that was a joke. just try more than the 32 it is set to?

Re: PHP Large amounts of data export into EXECL

Posted: Tue Dec 08, 2009 3:22 am
by t240034137
daedalus__ wrote:i dont know what that method is or what method you are currently using but increase the amount of available memory using the ini setting.

you don't have to set it to 2000M, that was a joke. just try more than the 32 it is set to?

this way i try. but I used to write code that take up too much memory。SO I want to know how to solve like this problems

Re: PHP Large amounts of data export into EXECL

Posted: Tue Dec 08, 2009 3:24 am
by t240034137
GOD HELP ME!