/    Sign up×
Community /Pin to ProfileBookmark

Why won’t this work?

[code=php]
<?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>
“)
?>
[/code]

[quote]

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

[/quote]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@pyroJun 06.2003 — The code is fine (barring the _'s that are there). Try re-typing it out, with out them, or try this:

[code=php]<?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>
")
?>[/code]
Copy linkTweet thisAlerts:
@WindchillauthorJun 06.2003 — Thanks but:

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

GRRR! Stupid PHP/
Copy linkTweet thisAlerts:
@pyroJun 06.2003 — I still think the problem may be the spaces were turned to _'s. Before we try anything else, try this:

[upl-file uuid=22a9bc85-c529-42f8-ba83-8e13e670fd01 size=434B]readfile.txt[/upl-file]
Copy linkTweet thisAlerts:
@WindchillauthorJun 06.2003 — Thanks Pyro,

? 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
Copy linkTweet thisAlerts:
@pyroJun 06.2003 — Yep... I've seen the problem before... ?
Copy linkTweet thisAlerts:
@WindchillauthorJun 06.2003 — *looks at his post count*

*looks at pyros*

Yes... I see ?
×

Success!

Help @Windchill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...