I have a php webpage that is pulling data from my MSSQL DB and printing it to a csv file. For all of my other pages this works fine. Then I get to this one which has a result set of almost 40000. I know that isn't that large, but it doesn't seem to be working. Here's what I've got going:
Click the export to excel button:
    echo "<form action='ExportToExcel.php' method='POST'>";
    echo "<div class='CenterStuff'>";
    echo "<input type='hidden' name='ExportToExcel' value='MatTrackingAll'/>";
    echo "<input type='hidden' name='Limit' value='$limit'/>";
    echo "<input type='hidden' name='Offset' value='$offset'/>";
    echo "<input type='submit' class='button' value='Export To Excel'>";
    echo "</div></form>";
Export to Excel: I was setting the $limit and $Offset from the page calling this, but changed it to try and find what was going on.
    $offset = 0;//$_POST['Offset'];
    $limit = 27250;//$_POST['Limit'];
    $tsql = "Select Id,State,ProjectNumber,SubProjectNumber,PONumber,POLineNumber,IMLineNumber,CalloutDetails,POStatus,BlanketRelease
            ,PODateIssued,DateNeeded,POINvoiceStatus,ItemCode,ItemDesc,QuantityOrdered,QuantityReceived,DateReceived,RecordStatus
            ,ShipToLocation,DeliverToLocation,ReceiverId,TraceNumber,BOL,PackSlipNumber,POTotalAmount,POLineAmount,CostCode,RequisitionId
            ,RequisitionLineNumber,Vendor,ExchangeName,ProjectType,COECurrentProjectStatus,ReadyForService,ScheduledShipDate,MaterialComments
            ,SchedulerComments,MaterialSpecialist
            from pmdb.MaterialTracking order by State,ProjectNumber OFFSET $offset ROWS FETCH NEXT $limit ROWS ONLY";
    $hsql = "select Headings from TableHeadings where TableName = 'MaterialTracking' and Headings != 'Edit' order by ID";
    $getqueries = $conn->query($tsql);
    $result = $getqueries->fetchALL(PDO::FETCH_ASSOC);
    $filename = $_POST['ExportToExcel'];
Then I have the part where I print to the csv. I have some var_dumps in there to so that I can see where the hold up is. When I run with more than the 27250 limit then I get a blank screen and nothing happens. It does not download a file. I know that the query is good, but it stops at the $result = $getqueries->fetchALL(PDO::FETCH_ASSOC);' and thevar_dumpandecho` that I have after don't print anything.
