PHP Large amounts of data export into EXECL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
t240034137
Forum Newbie
Posts: 5
Joined: Tue Dec 08, 2009 2:38 am

PHP Large amounts of data export into EXECL

Post 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!
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: PHP Large amounts of data export into EXECL

Post by daedalus__ »

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

Post by t240034137 »

daedalus__ wrote:

Code: Select all

ini_set("memory_limit","2000M");
mycomputer memory is not so big!
t240034137
Forum Newbie
Posts: 5
Joined: Tue Dec 08, 2009 2:38 am

Re: PHP Large amounts of data export into EXECL

Post 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
Last edited by t240034137 on Tue Dec 08, 2009 3:28 am, edited 2 times in total.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: PHP Large amounts of data export into EXECL

Post 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?
t240034137
Forum Newbie
Posts: 5
Joined: Tue Dec 08, 2009 2:38 am

Re: PHP Large amounts of data export into EXECL

Post 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
t240034137
Forum Newbie
Posts: 5
Joined: Tue Dec 08, 2009 2:38 am

Re: PHP Large amounts of data export into EXECL

Post by t240034137 »

GOD HELP ME!
Post Reply