0
Good , I have a query in the database , that returns me to depend on this query 5k lines to 30k lines , I’m generating already in excel through the code below , however when brings me about 5k of information , it takes a long time to load . Could someone help regarding the code or other way to generate excel ?
excel.php:
<?php
$file = 'planilha.xls';
header ("Content-type: application/x-msexcel");
header ("Content-Disposition: attachment; filename=\"{$file}\"" );
header ("Content-Description: PHP Generated Data" );
?>
<?php
define('DB_HOST' , "");
define('DB_USER' , "");
define('DB_PASSWORD' , "");
define('DB_NAME' , "");
define('DB_DRIVER' , "sqlsrv");
require_once "Conexao.php";
try{
//inicia a conexao
$Conexao = Conexao::getConnection();
$filial1 = $_POST[];
$filial2 = $_POST[];
$data_inicial = $_POST[_];
$data_final = $_POST[];
//faz a consulta na tabela procurando palavras do form
$query = $Conexao->query (" EXECUCAO DA MINHA PROCEDURE ");
$teste = $query->fetchAll();
}catch(Exception $e){
echo $e->getMessage();
exit;
}
?>
<table border="1">
<thead>
<tr>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
<th>
<center><b></b></center>
</th>
</tr>
</thead>
<?php
foreach($teste as $CLIENTE) {
?>
<tr>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE['']; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
<td>
<center>
<?php echo $CLIENTE[]; ?>
</center>
</td>
</tr>
<?php
}
?>
</table>
Usually code revisions need to be more specific and require more details.
– danieltakeshi
In the case , I presented my code of how I am generating Excel , my doubt is in the part of how could improve this code in specific . I described my entire code and explained why you’re making a possible improvement .
– Foloni