Re: Reading files
| From: | Ferhat Can | Date: | Thu, 27 Feb 2003 14:34:45 +0000 |
| Subject: | Re: Reading files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137394@lists.php.net to get a copy of this message | ||
Hi Chris,
You should delete the ; after the while statement because it causes an
infinite loop.
----- Original Message -----
From: "Chris Blake" <cblake@pbpc.co.za>
To: <php-general@lists.php.net>
Sent: Thursday, February 27, 2003 16:29
Subject: [PHP] Reading files
> Greetings...
>
> When the following runs..........
> ===========================================================
> <?php
>
> $handle = fopen ("fopen.txt", "r");
> $date = date("l dS of F Y h:i:s: A");
>
> while (!feof ($handle)) ;
> {
> $buffer = fgets($handle, 4096);
> echo '<textarea>'. $buffer. '</textarea>';
>
> }
> fclose($handle);
> ?>
> ============================================================
>
> .....it gives out........
>
> ============================================================
>
> Fatal error: Maximum execution time of 30 seconds exceeded in
> /home/data/ClientWebs/chrisplay/Things/fopen.php on line 16
> ============================================================
>
> I used the example from php.net/fget() and have tried a few changes
> based on other stuff I read, but to no avail.....
>
> Line 16 is = " while (!feof ($handle)) ; "
>
> Suggestions ?
>
>
> --
> Chris Blake
> Office : (011) 782-0840
> Cell : 083 985 0379
> It is reported that somewhere in the world, every 15 seconds, a woman
> gives birth to a child. She must be found and stopped.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php