Re: PHPExcel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



UGH!

I am now constantly getting an error of "PHP Fatal error: Allowed memory
size of 16777216 bytes exhausted (tried to allocate 936 bytes) on line 689"

Is there a way to continuously write to the file and avoid getting this
error?



On 7/3/08, Dan Shirah <mrsquash2@xxxxxxxxx> wrote:
>
> GOT IT!!!
>
> I changed my code to the following:
>
>
> $sql = "SELECT * FROM brev_pending_summary_detail WHERE name =
> '$name_code'";
>  if (!empty($case_age)) {
>   $sql.=" AND case_age_group = '$case_age'";
>  }
>  if (!empty($case_cat)) {
>   $sql.=" AND case_category = '$case_cat'";
>  }
>  if (!empty($case_status)) {
>   $sql.=" AND case_status = '$case_status'";
>  } // Start our query of the database
> $query = ifx_query($sql, $connect_id);
> $row = ifx_fetch_row($query);
> $results = array();
>
> echo date('H:i:s') . " Add some data<br />\n";
>
> for ($i = 3, $j = 0; $i <= $count; $i++, $j++) {
>  $results[$j] = ifx_fetch_row($query);
>
>  $objPHPExcel->getActiveSheet()->setCellValue('A' . $i,
> $results[$j]['stat_year']);
>  $objPHPExcel->getActiveSheet()->setCellValue('B' . $i,
> $results[$j]['stat_month']);
>  $objPHPExcel->getActiveSheet()->setCellValue('C' . $i,
> $results[$j]['name']);
>  $objPHPExcel->getActiveSheet()->setCellValue('D' . $i,
> $results[$j]['case_age_group']);
>  }
>
>
>
> I created a seperate query to get the row count...created an empty array (
> $results = array(); )
>
> I set $i = 3 so my results will start printing on line 3 of the spreadsheet
>
> I set $j = 0 so the row data will start at the first row of the results
> from my query
>
> Then I made the loop repeat until $i became equal to the total number of
> rows
>
> And I then set the value of my previsouly empty array equal to the current
> counted row of my query results
>
> And to round it all off I echo'd out my results by using the new
> $results($j) value appended with my database column names ['stat_year'] etc.
>
> AWESOME! I hope someone else learns from this or can use this!
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux