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!
PHP Large amounts of data export into EXECL
Moderator: General Moderators
-
t240034137
- Forum Newbie
- Posts: 5
- Joined: Tue Dec 08, 2009 2:38 am
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: PHP Large amounts of data export into EXECL
Code: Select all
ini_set("memory_limit","2000M");-
t240034137
- Forum Newbie
- Posts: 5
- Joined: Tue Dec 08, 2009 2:38 am
Re: PHP Large amounts of data export into EXECL
mycomputer memory is not so big!daedalus__ wrote:Code: Select all
ini_set("memory_limit","2000M");
-
t240034137
- Forum Newbie
- Posts: 5
- Joined: Tue Dec 08, 2009 2:38 am
Re: PHP Large amounts of data export into EXECL
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();
}
Last edited by t240034137 on Tue Dec 08, 2009 3:28 am, edited 2 times in total.
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: PHP Large amounts of data export into EXECL
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?
you don't have to set it to 2000M, that was a joke. just try more than the 32 it is set to?
-
t240034137
- Forum Newbie
- Posts: 5
- Joined: Tue Dec 08, 2009 2:38 am
Re: PHP Large amounts of data export into EXECL
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
-
t240034137
- Forum Newbie
- Posts: 5
- Joined: Tue Dec 08, 2009 2:38 am
Re: PHP Large amounts of data export into EXECL
GOD HELP ME!