Click to See Complete Forum and Search --> : Why won't this work?


Windchill
06-06-2003, 11:01 AM
<?php
print ("
<html>
<head>
<TITLE>Star One News</TITLE>
</head>
<BODY BACKGROUND='GFX/starz.gif'>
<H1>News:</H1>
");


//

$filename_=_"news.txt";
$fp_=_fopen($filename,_"r");
if_($fp)_{
____$text_=_fread_($fp,_filesize_($filename));
____fclose_($fp);
____echo_$text;
}
else_{
____echo_("File is not readable");
}


print ("
</BODY>
</HTML>
")
?>


Parse error: parse error in /home/staron/public_html/news.php on line 14

pyro
06-06-2003, 11:22 AM
The code is fine (barring the _'s that are there). Try re-typing it out, with out them, or try this:

<?php
print ("
<html>
<head>
<TITLE>Star One News</TITLE>
</head>
<BODY BACKGROUND='GFX/starz.gif'>
<H1>News:</H1>
");


//

$filename = "news.txt";
$fp = fopen($filename, "r");
if ($fp) {
$text = fread ($fp, filesize ($filename));
fclose ($fp);
echo $text;
}
else {
echo ("File is not readable");
}

print ("
</BODY>
</HTML>
")
?>

Windchill
06-06-2003, 11:24 AM
Thanks but:

:eek: Parse error: parse error in /home/staron/public_html/news.php on line 3

GRRR! Stupid PHP/

pyro
06-06-2003, 11:27 AM
I still think the problem may be the spaces were turned to _'s. Before we try anything else, try this:

Windchill
06-06-2003, 11:31 AM
Thanks Pyro,

:D I found it :p I was using a RTF editor(I'm not on my normal dev machine). Somehow it saved as text but made all the spaces turn in to _'s

pyro
06-06-2003, 11:46 AM
Yep... I've seen the problem before... ;)

Windchill
06-06-2003, 02:56 PM
*looks at his post count*
*looks at pyros*

Yes... I see :D