I have a page that displays data from a db2 database. I then have a button to export the data to a text file (csv). My display page works fine, no matter how many rows of data I have. It seems that if I have more than 2000 rows, then the browser displays my csv.php page, with no content. If there are less than 2000 rows, then I get the dialog box to save my file. Below is the code for my csv.php file. Any help would be greatly appreciated.
[code]
<?
//header(‘Content-Type: text/x-csv;’);
header(‘Content-Type: application/octet-stream;’);
header(“Content-Disposition: attachment; filename=fav_rx.txt”);
include “db2conn.php”;
include “config.php”;
include “sitecommon.php”;
$begin_dte = $_POST[‘begin_dte’];
$end_dte = $_POST[‘end_dte’];
$D = new mydb2;
$sql = ” SELECT
INCNE_ENTRY_FNAME, INCNE_ENTRY_LNAME, INCNE_ENTRY_ADDR1, INCNE_ENTRY_ADDR2, INCNE_ENTRY_CTY, INCNE_ENTRY_ST, INCNE_ENTRY_ZIP, INCNE_ENTRY_PHN1, INCNE_ENTRY_PHN2, INCNE_ENTRY_DOB, INCNE_ENTRY_EMAIL, INCNE_ENTRY_RPHNAME, INCNE_CONT_FIELD1, INCNE_CONT_FIELD2, INCNE_CONT_FIELD3, INCNE_CONT_FIELD4, INCNE_CONT_FIELD4, INCNE_COMMENT, INCNE_REQ_IND, INCNE_LST_MNT_TSMP FROM INET.INCNE_CONTEST_ENTRY WHERE INCNE_CONTEST_NBR = 1 and INCNE_LST_MNT_TSMP >= ‘” . $begin_dte . “‘ and INCNE_LST_MNT_TSMP <= ‘” . $end_dte . “‘”;
$order = ” ORDER BY INCNE_ROW_ID “;
$sql = $sql .$order;
$D->my_sel($sql);
//print $sql;
if ($D->ORA_ERR) {
echo “<font color=red>db2 error ->”
.$D->ORA_ERR_DESC
.”<-</font>>”;
}
if ($D->numrows != 0) {
echo (“First NametLast NametAddress1tAddress2tCitytSttZiptPhone NumbertEmailtBirthdatetPharmacist NametStore AddresstStore CitytStore StatetStore ZiptCommentstOfferstLast Update Timestamprn”);
for ($i=0; $i< $D->numrows; $i++) {
//$entry_date=$D->results[“INCNE_LST_MNT_TSMP”][$i];
$first_nme=$D->results[“INCNE_ENTRY_FNAME”][$i];
$last_nme=$D->results[“INCNE_ENTRY_LNAME”][$i];
$addr1=$D->results[“INCNE_ENTRY_ADDR1”][$i];
$addr2=$D->results[“INCNE_ENTRY_ADDR2”][$i];
$city=$D->results[“INCNE_ENTRY_CTY”][$i];
$st=$D->results[“INCNE_ENTRY_ST”][$i];
$zip=$D->results[“INCNE_ENTRY_ZIP”][$i];
$phn_nbr=$D->results[“INCNE_ENTRY_PHN1”][$i];
$birthdate=$D->results[“INCNE_ENTRY_DOB”][$i];
$email=$D->results[“INCNE_ENTRY_EMAIL”][$i];
$pharmacist_nme=$D->results[“INCNE_ENTRY_RPHNAME”][$i];
$store_address=$D->results[“INCNE_CONT_FIELD1”][$i];
$store_city=$D->results[“INCNE_CONT_FIELD2”][$i];
$store_st=$D->results[“INCNE_CONT_FIELD3”][$i];
$store_zip=$D->results[“INCNE_CONT_FIELD4”][$i];
//$store_number=$D->results[“INCNE_CONT_FIELD4”][$i];
$comments=$D->results[“INCNE_COMMENT”][$i];
$comments = str_replace(“r”, ”, $comments);
$comments = preg_replace(‘/(?<!>)n/’, ” “, $comments);
$offers=$D->results[“INCNE_REQ_IND”][$i];
$lastUpdateTimestamp=$D->results[“INCNE_LST_MNT_TSMP”][$i];
//$position = strpos($comments, “r”);
echo (“$first_nmet$last_nmet$addr1t$addr2t$cityt$stt$zipt$phn_nbrt$emailt$birthdatet$pharmacist_nmet$store_addresst$store_cityt$store_stt$store_zipt$commentst$offerst$lastUpdateTimestamp”);
echo (“rn”);
}
}
//echo “anb”;
?>
Thanks