Page 1 of 1

[SOLVED]Unexplainable 'white screen'

Posted: Wed Jul 02, 2008 4:29 pm
by foxmajik
Hello,

I am new to the forum here and will be grateful for any help you can provide.

I've been over and over my code and I can't find anything wrong with it.

It was working for a few minutes, then I removed some comments, and since then I haven't been able to get it working.

I am using some code to split lines from a Asterisk queue log into nested arrays. I can't get it to output anything. All I get is the "white screen."

Here's the code:

Code: Select all

<?php
 
$file_handle = fopen("queue_log", "r");
 
while (!feof($file_handle) && $max_lines-- > 1000)
 
{
$line_of_text = fgets($file_handle);
$parts = explode('|', $line_of_text);
$stack[] = $parts;
}
 
print_r ($stack[0]);
 
fclose($file_handle);
 
?>
 
Here's what it's supposed to do:

1. Open the file queue_log and read 1000 lines from it.

(the file is about 5MB and I'm sure I'm not running out of memory because when I do I get an error in the browser telling me I have run out of memory).

2. Explode all of the lines into separate arrays.

3. Store the arrays in nested arrays.

4. Print the first nested array '0' from the $stack array

I hope someone can make suggestions on how to fix this.

Thanks in advance!

Maj

Re: Unexplainable 'white screen'

Posted: Wed Jul 02, 2008 4:38 pm
by foxmajik
Hello!

I managed to fix it with some help from a local code guru.

The problem I had:

I wasn't defining $max_lines in the right place.

I was trying to define it in "& $max_lines--" which breaks the code because I'm counting down to that value by decrementing $max_lines each time (using $max_lines--).

Thanks anyways though. =)