Re: [PHP] Php warning message

2008-02-21 Thread Richard Lynch
On Wed, February 20, 2008 3: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);

if (!$boardFileHandle){
  die(Unable to open $boardFile\n);
}

The fact that you are seeing zero error messages indicates that you
almost for sure aren't checking the right places to find error
messages...

Figure out what's in your php.ini and get it to use E_ALL and send the
errors to a log or something.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Php warning message

2008-02-20 Thread Jason Pruim


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
[EMAIL PROTECTED]

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



Re: [PHP] Php warning message

2008-02-20 Thread Greg Bowser

 *$boardFile = MessageBoard.txt;
 $boardFileHandle = fopen($boardFile,r);
 for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
  $colorLine = fgets(boardFilehandle);
  if ($counter % 2 == 0) {
  echo font color='00ff00'$colorline/font;
  } else {
  echo $colorline;
  }
 }
 fclose($boardFileHandle);*


 Looks like you're missing a $ on line 4:
 $colorLine = fgets(boardFilehandle);

Should be
 $colorLine = fgets($boardFilehandle);

[snip]
I may be showing my ignorance here... But on your if ($counter % 2
==0) line what does the % do? Was that possibly a typo?
[/snip]

It's the modulus operator; he's trying to make every other line a different
color. :)

-- Greg


[PHP] Php warning message

2008-02-20 Thread Yuval Schwartz
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) {
  echo font color='00ff00'$colorline/font;
 } else {
  echo $colorline;
 }
}
fclose($boardFileHandle);*




Thank you


RE: [PHP] Php warning message

2008-02-20 Thread Andrés Robinet
 -Original Message-
 From: Jason Pruim [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, February 20, 2008 4:39 PM
 To: Yuval Schwartz
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] 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
 [EMAIL PROTECTED]
 

% 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: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  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



Re: [PHP] Php warning message

2008-02-20 Thread Chris


I may be showing my ignorance here... But on your if ($counter % 2 ==0) 
line what does the % do? Was that possibly a typo?


% is the modulus operator, so basically that will alternate between a 
line having a font tag and not having a font tag.


http://www.php.net/operators.arithmetic

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Php warning message

2008-02-20 Thread Daniel Brown
On Wed, Feb 20, 2008 at 4:38 PM, Jason Pruim [EMAIL PROTECTED] wrote:
  I may be showing my ignorance here... But on your if ($counter % 2
  ==0) line what does the % do? Was that possibly a typo?

If the line is divisible by 2.


  Also, it might be good to point out what line 52 is :)

He did it's the line on which you'll find foef().  ;-P


Yuval,

Change your code to:

?
$filename = ./MessageBoard.txt;
$handle = fopen($filename,r);
for($counter=1;!feof($handle);$counter++) {
$colorline = fgets($handle);
if ($counter % 2 == 0) {
echo font color=\#00ff00\ /.$colorline./font\n;
} else {
echo $colorline;
}
}
fclose($handle);
?

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Php warning message

2008-02-20 Thread tedd

At 11:29 PM +0200 2/20/08, Yuval Schwartz wrote:

Hello and thank you,

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



Try something like this instead.

In your html:

tr class=row?php echo($j++  1 );?

In your css:

.row0
{
background-color: #B3C6FF;  /*  blue */
}

.row1
{
background-color: #FFDD75;  /*  yellow */
}

You're welcome and goodbye.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Php warning message

2008-02-20 Thread Casey
On Feb 20, 2008, at 1:29 PM, Yuval Schwartz  
[EMAIL PROTECTED] 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) {
 echo font color='00ff00'$colorline/font;
} else {
 echo $colorline;
}


The loop looks ugly :/
$colored = false;
while (!feof($boardFileHandle)) {
$line = fgets($boardFileHandle);
if ($colored)
echo 'span class=colored', $line, '/spanbr /';
else
echo $line, 'br /';
$colored = !$colored;
}



}
fclose($boardFileHandle);*




Thank you


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



Re: [PHP] Php warning message

2008-02-20 Thread Jochem Maas

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