Re: Appended [PHP] Solved [PHP] ASP guy needs help.

From: Date: Wed, 22 Sep 2004 12:35:14 +0000
Subject: Re: Appended [PHP] Solved [PHP] ASP guy needs help.
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-197555@lists.php.net to get a copy of this message
LW Ellis wrote:
LW Ellis wrote:
Never mind... As usual, about the time you ask for help, the brain gets unstuck and you find the solution.
You should post back with a solution (append SOLVED to your subject) so that it becomes part of the thread (and archived). This way, next time someone else has a similar issue, they can search the archives for the post and find the answer. Not that many people search the archives, but hey -- here's hopin :)
My answer I'm sure there are others... <?php if (!($fp = fopen("test.txt", "r")))
       exit("Unable to open the input file.");
while (!feof($fp)) { $buffer[] = fgets($fp, 1024); } fclose($fp); ?> // change the [0] to 1,2,3,4,...for each line of the text file you want to display. <? echo $buffer[0]?> Leon PS No I didn't want to while it.
W/out making large array in memory: $fp = fopen("test.txt", "r")
       or die("Unable to open the input file.");
$display_line = 6; $i=1; while (($line = fgets($fp, 1024)) !== false && $i < $display_line) $i++; echo htmlspecialchars($line); fclose($fp);

« previous php.general (#197555) next »