PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
~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.
~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.
$Line will never be != "" because you're always appending "<br>" to it before doing the test, so an empty line in the file will still contain "<br>" at the point when you test it.
because a seemingly blank line may still have spaces in.
Double check that file.txt is in the right directory (the same directory as your PHP), and possibly prefix the file with './' to ensure that it is using the correct directory.