really, REALLY easy question.
Posted: Sun Nov 23, 2008 3:08 pm
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hi, my first time posting.
So, I am just starting off PhP and I am trying to make some code where a loop reads some data in a file, and continues reading until it comes across a blank line in a file. The problem is, nothing prints out. Have fun picking out all errors I have made.
file.txt is....
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hi, my first time posting.
So, I am just starting off PhP and I am trying to make some code where a loop reads some data in a file, and continues reading until it comes across a blank line in a file. The problem is, nothing prints out. Have fun picking out all errors I have made.
Code: Select all
<?php
$myFile = "file.txt";
$fh = fopen($myFile, 'r');
$Line = fgets($fh)."<br>";
while ($Line != "<br>") {
$All = $All.$Line
$Line = fgets($fh)."<br>";
}
fclose($fh);
echo $All;
?>Code: Select all
Hello Sire
I am a squire.
Do not see me.~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: