Estou usando o método de geração de EXCEL através do PHP via header , contudo a quantidade de linhas que tem que ser retornada é muito grande mais de 10 mil linhas a depender da consulta com isso está apresentando alguns erros como não está vindo completa ( Só me vem uma quantidade aleatória de Dados mas nunca a quantidade correta de linhas ) e o arquivo fica muito grande Ex: 42MB . Alguém sabe um método para isso deixar de acontecer ?
<?php
$file = 'CARTEIRA.xls';
header ("Content-type: application/x-msexcel");
header ("Content-Disposition: attachment; filename=\"{$file}\"" );
header ("Content-Description: PHP Generated Data" );
?>
<?php include("conexao/banco_de_dados.php")?>
<?php include("cabecalho/cabecalho.php")?>
$XXXX = $_POST['XXXX'];
$YYYY= $_POST['YYYY'];
$sql= "SELECT * FROM VW_LIXO
WHERE ";
$ordenacao =" ORDER BY FILIAL ";
$query = ($sql." XXXX IN ('$xxxx')
AND YYYY = '$yyyy'
".$ordenacao); }
$params = array();
$options = array('Scrollable' => SQLSRV_CURSOR_KEYSET);
$stmt = sqlsrv_query($conn, $query, $params, $options);
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
</head>
<body>
<table>
<thead>
<tr>
<th>xxxx</th>
<th>yyyy</th>
</thead>
</thead>
<?php while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) { ?>
<tr>
<td><?php echo $row['xxxx']; ?></td>
<td><?php echo $row['yyyy']; ?></td>
</tr>
<?php } ?>
</table>
<?php while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) { ?>
falha. – Guilherme Nascimento♦ 4/09/20 às 20:04