RE: Php warning message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Jason Pruim [mailto:japruim@xxxxxxxxxx]
> Sent: Wednesday, February 20, 2008 4:39 PM
> To: Yuval Schwartz
> Cc: php-general@xxxxxxxxxxxxx
> Subject: Re:  Php warning message
> 
> 
> On Feb 20, 2008, at 4:29 PM, Yuval Schwartz wrote:
> 
> > 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.
> >
> > Here is my code if you're interested (it's so that I color every 2nd
> > line in
> > the text):
> >
> > *$boardFile = "MessageBoard.txt";
> > $boardFileHandle = fopen($boardFile,"r");
> > for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
> > $colorLine = fgets(boardFilehandle);
> > if ($counter % 2 == 0) {
> 
> I may be showing my ignorance here... But on your if ($counter % 2
> ==0) line what does the "%" do? Was that possibly a typo?
> 
> Also, it might be good to point out what line 52 is :)
> 
> >
> >  echo "<font color='00ff00'>$colorline</font>";
> > } else {
> >  echo $colorline;
> > }
> > }
> > fclose($boardFileHandle);*
> >
> >
> >
> >
> > Thank you
> 
> --
> 
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> japruim@xxxxxxxxxx
> 

% is the modulus (= remainder most of the time) operator. 8 % 2 == 0, 9 % 4 ==
1, etc

You are missing a $ at fgets(boardFilehandle); (should be
fgets($boardFilehandle);).

Are you sure the file handle is valid anyway?

//
$boardFileHandle = fopen($boardFile,"r");
If ($boardFileHandle) {
	die("very bad things happen these days");
}
//

Regards,

Rob



Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: info@xxxxxxxxxxxxx  | MSN Chat: best@xxxxxxxxxxxxx  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux