Guys I have a problem with XLS export, when I try to export my grid with more than 5000 records is too slow (20 to 30 minutes). How do I fix this problem?
First it shows me an error: allowed memory limit, that I resolved by modifying the php.ini but the problem continue.
HELP!!!
Re: Trouble with XLS export
Hello,
try to change these lines, max_execution_time to 3600 and memory_limit = 512M,
regards
Re: Trouble with XLS export
I already changed these lines in my php.ini and still I have the same problem, even I tried changing the memory_limit to 1024M.
What else I can do?
Re: Trouble with XLS export
if you try to generate the xls, with less than 5000 records, just a simple one, with 100 for example. It will take too long to ?
Re: Trouble with XLS export
No with 100 records it take a few seconds.
But I solved the problem by creating a javascript button called “XLS” which opens in a new window a php page, with the following code:
<?php
header('Content-type: application/vnd.ms-excel');
header("Content-Disposition: attachment; filename=< nombre_archivo.xls >");
header("Pragma: no-cache");
header("Expires: 0");
$res=array();
//
//Here should be the connection to the database and the SQL query that passes the data to the array $ res
//
$arr=(array_keys($res[0]));
for($i=0;$i<count($res);$i++){
$val[]=(array_values($res[$i]));
}
echo "<table border=1>
";
echo "<tr>
";
for($i=0;$i<count($arr);$i++){
echo "<th>".$arr[$i]."</th>
";
}
echo "</tr>
";
echo "<tr>
";
for($i=0;$i<count($res);$i++){
for($j=0;$j<count($arr);$j++){
echo "<td>".$val[$i][$j]."</td>
";
}
echo "<tr>
";
}
echo "</table>
";
}
?>
I too am having the same problem with large record sets. Specifically it doesn’t export if the record set is above 4,000 to XLS. No problem with CSV or other formats. I have made changes to php.ini and mysql parameters. I can do an external control work around, but I really don’t want to. Does anybody have any further information on this?
I think that it may depend on the xls version. Which one do you use?
Just to share,
I managed to solve it by increasing value : max_execution_time to 3600 inside php.ini
But maybe my datas are not that big.
Cheers
Thanks kakibox !!
I had success with changing the value.