Yuval Schwartz schreef:
Hello and thank you,

Another question, I get a message:

*Warning*: feof(): supplied argument is not a valid stream resource in *
/home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52*
**
And I've tried troubleshooting for a while; I'm pretty sure I'm opening the
file handle correctly and everything but I can't get feof or similar
functions like fgets to work.

you pretty sure? your code doesn't check that the file handle is valid.


Here is my code if you're interested (it's so that I color every 2nd line in
the text):

*$boardFile = "MessageBoard.txt";

do you know what the current working directory is? my guess
is that whatever it is the text file is not in that directory.
try setting an absolute path to the text file e.g.


$boardFile = "/path/to/my/MessageBoard.txt";

and then do something like ...

$boardFileHandle = fopen($boardFile,"r");

if (!$boardFileHandle)
        die ('no messages, or something equally annoying!');

for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
 $colorLine = fgets(boardFilehandle);
 if ($counter % 2 == 0) {
  echo "<font color='00ff00'>$colorline</font>";

the font tag is evil - go read alistapart for the next 6 hours ;-)

 } else {
  echo $colorline;
 }
}
fclose($boardFileHandle);*




Thank you


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to