parse error help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ultrajet
Forum Newbie
Posts: 2
Joined: Sun Apr 12, 2009 10:40 pm

parse error help

Post by ultrajet »

Hi everyone,

I'm a php newbie and am using a xampp and a book to learn php. Unfortunately while following the codes in the book, I kept getting parse error. I don't know why. Please check if you can see what's wrong with it. Thanks

This is the code for movierate.php

Code: Select all

 
<?php
session_start();
//check to see if user has logged in with a valid password
if ($_SESSION[‘authuser’] != 1) {
echo “Sorry, but you don’t have permission to view this page, you loser!”;
exit();
}
?>
<html>
<head>
<title>My Movie Site - <?php echo $_REQUEST[‘favmovie’]; ?></title>
</head>
<body>
<?php
echo “Welcome to our site, “;
echo $_SESSION[‘username’];
echo “! <br>”;
echo “My favorite movie is “;
echo $_REQUEST[‘favmovie’];
echo “<br>”;
$movierate = 5;
echo “My movie rating for this movie is: “;
echo $movierate;
?>
</body>
</html>
 
This is the code for movierate1.php

Code: Select all

 
<?php
session_start();
if ($_SESSION[‘authuser’] != 1) {
echo “Sorry, but you don’t have permission to view this page, you loser!”;
exit();
}
?>
<html>
<head>
<title>My Movie Site - <?php echo $_REQUEST[‘favmovie’]; ?></title>
</head>
<body>
<?php
echo “Welcome to our site, “;
echo $_SESSION[‘username’];
echo “! <br>”;
echo “My favorite movie is “;
echo $_REQUEST[‘favmovie’];
echo “<br>”;
$movierate = 5;
echo “My movie rating for this movie is: “;
echo $movierate;
?>
</body>
</html>
 
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: parse error help

Post by requinix »

ultrajet wrote:Unfortunately while following the codes in the book, I kept getting parse error. I don't know why.
But you do know something we don't: which file has the error and on which line. It's clearly stated in the error message.
ultrajet
Forum Newbie
Posts: 2
Joined: Sun Apr 12, 2009 10:40 pm

Re: parse error help

Post by ultrajet »

while in browser it writes:
Parse error: parse error in C:\xampp\htdocs\PHP\moviesite.php on line 3

Any ideas how to fix this?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: parse error help

Post by requinix »

Well, little problem here. You posted movierate.php and movierate1.php, yet the error specifically mentions moviesite.php.

How about posting that one?
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: parse error help

Post by McInfo »

Are you using MS Word or some other rich text editor to write your script?

Notice the single and double quotes.

Code: Select all

if ($_SESSION[‘authuser’] != 1)
    echo “Sorry, but you don’t have permission to view this page!”;
is not the same as

Code: Select all

if ($_SESSION['authuser'] != 1)
    echo "Sorry, but you don’t have permission to view this page!";
Write code with a text editor that uses ASCII characters, not a word processor that turns your keystrokes into weird characters.

I recommend Eclipse PDT.

Edit: This post was recovered from search engine cache.
Post Reply