I am reading a MySQL database with a query that returns 187,000 records and I am writing the data to a flat file. It just stops without any error around 15,000 records to 35,000 records.
I thought maybe the database connection was timing out so I started pulling 10,000 records at a time with LIMIT, but it still happens. So I imagine it is either the browser or PHP that is timing out. Here is my code. If there is a better way of doing this I am totally open to hearing.
$sql->Query($stype.$search);
$checkrows = $sql->rows;
if ($checkrows > 0){
$fh = fopen($listname, 'w');
for ($i = 0; $i < $sql->rows; $i++) {
$sql->Fetch($i);
$email .= $sql->data[1]."\n";
fwrite($fh, $email);
$cot++;
echo $cot."-".$sql->data[1]."<br>";
}
fclose($fh);
}
My mistake was this line of code: echo
$email .= $sql->data[1]."\n";It should have been:
echo $email = $sql->data[1]."\n";